Fixing server side order+search+pagination mixes

Enabling server side component by default
parent d41cadcb
...@@ -9,7 +9,7 @@ export default [ ...@@ -9,7 +9,7 @@ export default [
{ {
path: '/page/pages', path: '/page/pages',
name: 'admin.page.page.index', name: 'admin.page.page.index',
component: PageTable, component: PageTableServerSide,
props: { props: {
translations translations
} }
......
...@@ -4,14 +4,14 @@ ...@@ -4,14 +4,14 @@
<div class="box box-primary"> <div class="box box-primary">
<div class="box-body"> <div class="box-body">
<div class="sc-table"> <div class="sc-table">
<div class="tool-bar el-row"> <div class="tool-bar el-row" style="padding-bottom: 20px;">
<div class="actions el-col el-col-5"> <div class="actions el-col el-col-5">
<router-link :to="{name: 'admin.page.page.create'}"> <router-link :to="{name: 'admin.page.page.create'}">
<el-button type="primary"><i class="el-icon-edit"></i> {{ translate('page', 'create page') }}</el-button> <el-button type="primary"><i class="el-icon-edit"></i> {{ translate('page', 'create page') }}</el-button>
</router-link> </router-link>
</div> </div>
<div class="search el-col el-col-5"> <div class="search el-col el-col-5">
<el-input icon="search" @change="performSearch"> <el-input icon="search" @change="performSearch" v-model="searchQuery">
</el-input> </el-input>
</div> </div>
</div> </div>
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
<div class="pagination-wrap"> <div class="pagination-wrap" style="text-align: center; padding-top: 20px;">
<el-pagination <el-pagination
@size-change="handleSizeChange" @size-change="handleSizeChange"
@current-change="handleCurrentChange" @current-change="handleCurrentChange"
...@@ -72,6 +72,7 @@ ...@@ -72,6 +72,7 @@
meta: {}, meta: {},
order_meta: {}, order_meta: {},
links: {}, links: {},
searchQuery: '',
} }
}, },
methods: { methods: {
...@@ -107,6 +108,7 @@ ...@@ -107,6 +108,7 @@
per_page: this.meta.per_page, per_page: this.meta.per_page,
order_by: this.order_meta.order_by, order_by: this.order_meta.order_by,
order: this.order_meta.order, order: this.order_meta.order,
search: this.searchQuery,
})) }))
.then(response => { .then(response => {
this.data = response.data.data; this.data = response.data.data;
...@@ -118,10 +120,11 @@ ...@@ -118,10 +120,11 @@
console.log('sorting', event); console.log('sorting', event);
axios.get(route('api.page.page.indexServerSide', { axios.get(route('api.page.page.indexServerSide', {
// page: this.meta.current_page, page: this.meta.current_page,
// per_page: this.meta.per_page, per_page: this.meta.per_page,
order_by: event.prop, order_by: event.prop,
order: event.order, order: event.order,
search: this.searchQuery,
})) }))
.then(response => { .then(response => {
this.data = response.data.data; this.data = response.data.data;
...@@ -135,7 +138,7 @@ ...@@ -135,7 +138,7 @@
performSearch(query) { performSearch(query) {
console.log('searching:' + query); console.log('searching:' + query);
axios.get(route('api.page.page.indexServerSide', { axios.get(route('api.page.page.indexServerSide', {
'search': query search: query,
})) }))
.then(response => { .then(response => {
this.data = response.data.data; this.data = response.data.data;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment