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