This commit is contained in:
2021-02-01 17:52:20 +00:00
parent f698d5fc72
commit d198bea613
3 changed files with 37 additions and 8 deletions

View File

@@ -436,16 +436,33 @@ export default {
//{ "page": 1, "itemsPerPage": 10, "sortBy": [], "sortDesc": [], "groupBy": [], "groupDesc": [], "mustSort": false, "multiSort": false }
//this code works around some weird bug that causes visible items to be selected in grid (only, not in actual selected array, just a visual thing)
// when breakpoint is switched between wide and narrow either way. No idea why it happens but this fixes that issue and also ensures that there are no
//spurious fetches happening just because the view has changed
//See what has changed and record it for processing
let sortHasChanged = !(
window.$gz.util.isEqualArraysOfPrimitives(
this.dataTablePagingOptions.sortBy,
this.lastDataTablePagingOptions.sortBy
) &&
window.$gz.util.isEqualArraysOfPrimitives(
this.dataTablePagingOptions.sortDesc,
this.lastDataTablePagingOptions.sortDesc
)
);
if (
this.lastDataTablePagingOptions.page ==
this.dataTablePagingOptions.page &&
this.lastDataTablePagingOptions.itemsPerPage ==
this.dataTablePagingOptions.itemsPerPage
this.dataTablePagingOptions.itemsPerPage &&
!sortHasChanged
) {
//no effective change, return
console.log("NO CHANGE");
return;
}
console.log("Has changed");
//has changed something important so refetch and put a pin in last paging settings for next time
this.getDataFromApi();
this.lastDataTablePagingOptions = this.dataTablePagingOptions;