backend pagination and sorting from laravel database

This commit is contained in:
Peter Papp
2020-08-21 16:04:21 +02:00
parent 3e6e046dfc
commit 6dd0b4f026
37 changed files with 853 additions and 505 deletions

View File

@@ -1,6 +1,6 @@
<template>
<WidgetWrapper :icon="icon" :title="title">
<DatatableWrapper v-if="users" :paginator="false" :columns="columns" :data="users" class="table table-users">
<DatatableWrapper @init="isLoading = false" api="/api/dashboard/new-users" :paginator="false" :columns="columns" class="table table-users">
<template slot-scope="{ row }">
<tr>
<td style="width: 300px">
@@ -65,27 +65,26 @@
data() {
return {
isLoading: false,
users: undefined,
columns: [
{
label: this.$t('admin_page_user.table.name'),
field: 'data.attributes.name',
sortable: true
field: 'name',
sortable: false
},
{
label: this.$t('admin_page_user.table.role'),
field: 'data.attributes.role',
sortable: true
field: 'role',
sortable: false
},
{
label: this.$t('admin_page_user.table.storage_used'),
field: 'relationships.storage.data.attributes.used',
sortable: true
field: 'used',
sortable: false
},
{
label: this.$t('admin_page_user.table.created_at'),
field: 'data.attributes.created_at_formatted',
sortable: true
field: 'created_at',
sortable: false
},
{
label: this.$t('admin_page_user.table.action'),
@@ -107,13 +106,6 @@
}
}
},
created() {
axios.get('/api/dashboard/new-users')
.then(response => {
this.users = response.data.data
this.isLoading = false
})
}
}
</script>