Skip to content

Commit 9683910

Browse files
committed
fix: Search in server pagination table not working quasarframework#2048
1 parent 85572ac commit 9683910

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

src/components/table/table-filter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export default {
1919
watch: {
2020
filter () {
2121
this.$nextTick(() => {
22-
this.setPagination({ page: 1 })
22+
this.setPagination({ page: 1 }, true)
2323
})
2424
}
2525
}

src/components/table/table-pagination.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import extend from '../../utils/extend'
22

3-
function paginationChanged (oldPag, newPag) {
3+
function samePagination (oldPag, newPag) {
44
for (let prop in newPag) {
55
if (newPag[prop] !== oldPag[prop]) {
6-
return true
6+
return false
77
}
88
}
9-
return false
9+
return true
1010
}
1111

1212
function fixPagination (p) {
@@ -87,17 +87,24 @@ export default {
8787
}
8888
},
8989
methods: {
90-
setPagination (val) {
90+
__sendServerRequest (pagination) {
91+
this.requestServerInteraction({
92+
pagination,
93+
filter: this.filter
94+
})
95+
},
96+
setPagination (val, forceServerRequest) {
9197
const newPagination = fixPagination(extend({}, this.computedPagination, val))
9298

93-
if (!paginationChanged(this.computedPagination, newPagination)) {
99+
if (samePagination(this.computedPagination, newPagination)) {
100+
if (this.isServerSide && forceServerRequest) {
101+
this.__sendServerRequest(newPagination)
102+
}
94103
return
95104
}
96105

97106
if (this.isServerSide) {
98-
this.requestServerInteraction({
99-
pagination: newPagination
100-
})
107+
this.__sendServerRequest(newPagination)
101108
return
102109
}
103110

0 commit comments

Comments
 (0)