This commit is contained in:
2020-02-25 18:18:19 +00:00
parent af16680548
commit 0668729181

View File

@@ -381,19 +381,22 @@ export default {
listViewChanged: function() {
var vm = this;
console.log("listViewchanged: TOP b4 remove unsaved");
console.log(vm.pickLists.listViews);
//If listview had changed it can only have changed *away* from the unsaved filter item if it's present so just remove that if it exists
window.$gz._.remove(vm.pickLists.listViews, function(n) {
return n.id == -1;
});
if (vm.listViewId == -1) {
vm.listViewId = 0;
//If listview had changed it can only have changed *away* from the unsaved filter item if it's present so just remove teh unsaved filter item if it exists
//DANGER DANGER WARNING: if using lodash to remove item it might mess with vue reactivity
//this example does remove from the array and does update a plain mustache rendition of it on the page but doesn't update the select itself
//whereas using the native javascript array splice function *does* update the select because vue wraps splice and other native methods specifically
//so it can properly update the dom
// window.$gz._.remove(vm.pickLists.listViews, function(n) {
// return n.id == -1;
// });
for (var i = vm.pickLists.listViews.length - 1; i >= 0; i--) {
if (vm.pickLists.listViews[i].id === -1) {
vm.pickLists.listViews.splice(i, 1);
}
}
//
console.log(vm.pickLists.listViews);
console.log(vm.listViewId);
var ShouldGetData = vm.dataTablePagingOptions.page == 1;