This commit is contained in:
@@ -298,7 +298,7 @@ export default {
|
|||||||
loading: true,
|
loading: true,
|
||||||
dataTablePagingOptions: {},
|
dataTablePagingOptions: {},
|
||||||
listViewId: 0,
|
listViewId: 0,
|
||||||
listView: {},
|
listView: undefined,
|
||||||
pickLists: {
|
pickLists: {
|
||||||
listViews: []
|
listViews: []
|
||||||
},
|
},
|
||||||
@@ -378,23 +378,25 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
listViewChanged: function() {
|
listViewChanged: function() {
|
||||||
console.log("listViewchanged: TOP");
|
//console.log("listViewchanged: TOP");
|
||||||
var vm = this;
|
var vm = this;
|
||||||
if (this.listViewId == 0) {
|
if (vm.listViewId == 0) {
|
||||||
//default view, no saved, no cached
|
//default view, no saved, no cached
|
||||||
this.listView = undefined;
|
vm.listView = undefined;
|
||||||
console.log(
|
// console.log(
|
||||||
"listViewchanged: Default NO LIST VIEW selected - Calling saveformsettings"
|
// "listViewchanged: Default NO LIST VIEW selected - Calling saveformsettings"
|
||||||
);
|
// );
|
||||||
saveFormSettings(vm);
|
saveFormSettings(vm);
|
||||||
} else if (this.listViewId > 0) {
|
vm.getDataFromApi();
|
||||||
|
} else if (vm.listViewId > 0) {
|
||||||
(async function() {
|
(async function() {
|
||||||
console.log("listViewchanged: awaiting fetchListView...");
|
// console.log("listViewchanged: awaiting fetchListView...");
|
||||||
await fetchListView(vm);
|
await fetchListView(vm);
|
||||||
console.log(
|
// console.log(
|
||||||
"listViewchanged: back from fetchListView calling save form settings"
|
// "listViewchanged: back from fetchListView calling save form settings"
|
||||||
);
|
// );
|
||||||
saveFormSettings(vm);
|
saveFormSettings(vm);
|
||||||
|
vm.getDataFromApi();
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -428,20 +430,19 @@ export default {
|
|||||||
listOptions.Limit = itemsPerPage;
|
listOptions.Limit = itemsPerPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
//is there a filter?
|
//effective ListView
|
||||||
if (vm.dataFilterId != 0) {
|
if (vm.listViewId != 0) {
|
||||||
|
//we have a listview id so there will be a temp cached listview
|
||||||
listOptions["DataFilterID"] = vm.dataFilterId;
|
listOptions["DataFilterID"] = vm.dataFilterId;
|
||||||
}
|
}
|
||||||
|
|
||||||
vm.loading = true;
|
vm.loading = true;
|
||||||
|
|
||||||
// {
|
// {
|
||||||
// "offset": 0,
|
// "offset": 0,
|
||||||
// "limit": 0,
|
// "limit": 0,
|
||||||
// "mini": true,
|
|
||||||
// "dataListKey": "string",
|
// "dataListKey": "string",
|
||||||
// "filterJson": "string",
|
// "listView": "string"
|
||||||
// "sortJson": "string"
|
|
||||||
// }
|
// }
|
||||||
|
|
||||||
window.$gz.api
|
window.$gz.api
|
||||||
@@ -449,7 +450,7 @@ export default {
|
|||||||
offset: listOptions.Offset,
|
offset: listOptions.Offset,
|
||||||
limit: listOptions.Limit,
|
limit: listOptions.Limit,
|
||||||
dataListKey: vm.dataListKey,
|
dataListKey: vm.dataListKey,
|
||||||
listView: ""
|
listView: vm.listView
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
//NOTE: This is how to call an async function and await it from sync code
|
//NOTE: This is how to call an async function and await it from sync code
|
||||||
@@ -674,7 +675,7 @@ function populatePickLists(vm) {
|
|||||||
// Fetch and cache list view
|
// Fetch and cache list view
|
||||||
//
|
//
|
||||||
async function fetchListView(vm) {
|
async function fetchListView(vm) {
|
||||||
console.log("fetchListView::TOP");
|
//console.log("fetchListView::TOP");
|
||||||
if (!vm.listViewId) {
|
if (!vm.listViewId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -683,10 +684,10 @@ async function fetchListView(vm) {
|
|||||||
window.$gz.errorHandler.handleFormError(res.error, vm);
|
window.$gz.errorHandler.handleFormError(res.error, vm);
|
||||||
} else {
|
} else {
|
||||||
vm.listView = res.data.listView;
|
vm.listView = res.data.listView;
|
||||||
console.log(
|
// console.log(
|
||||||
"fetchListView::insideGet, data returned, set listview to new value " +
|
// "fetchListView::insideGet, data returned, set listview to new value " +
|
||||||
vm.listView
|
// vm.listView
|
||||||
);
|
// );
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -695,7 +696,7 @@ async function fetchListView(vm) {
|
|||||||
//
|
//
|
||||||
function saveFormSettings(vm) {
|
function saveFormSettings(vm) {
|
||||||
// console.log("saveFormSettings::TOP");
|
// console.log("saveFormSettings::TOP");
|
||||||
//do we need to persist this listview (only if it's an unsaved one)
|
|
||||||
var unsavedlv = vm.listView;
|
var unsavedlv = vm.listView;
|
||||||
var cachedlv = vm.listView;
|
var cachedlv = vm.listView;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user