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

@@ -149,13 +149,7 @@ todo: filter, can be programmatic or user, user saves, can choose from list
TODO: LIST VIEW REPLACMENT OUTSTANDING TO DO
Client fixup <---= CURRENTLY HERE
WHERE IT"S AT:
listcolumnview form works but has issues:
un translated title
Items don't stay in their location when set to not include and saved
not sure if this is a problem or just necessary but it's jarring as is different than before, maybe better though as all visible are at the top??
figure it out!
icon is filter need to pick new icon for data-list-column-view
"view" related stuff? Something that looks like columns?
Fixup client so existing client works with new filter and sort system *before* porting UI

View File

@@ -639,6 +639,24 @@ export default {
return ret;
},
///////////////////////////////////////////////
// Simple array equality comparison
// (will NOT work on arrays of objects)
isEqualArraysOfPrimitives: function(a, b) {
if (a === b) return true;
if (a == null || b == null) return false;
if (a.length !== b.length) return false;
// If you don't care about the order of the elements inside
// the array, you should sort both arrays here.
// Please note that calling sort on an array will modify that array.
// you might want to clone your array first.
for (var i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) return false;
}
return true;
},
///////////////////////////////////////////////
// Use geolocation api to attempt to get current location
// try high accuracy first and downgrade if unavailable
//https://www.openstreetmap.org/?mlat=48.3911&mlon=-124.7353#map=12/48.3910/-124.7353

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;