This commit is contained in:
2020-02-25 00:16:19 +00:00
parent 5f621d76a0
commit 6087ea864c
2 changed files with 32 additions and 16 deletions

View File

@@ -500,9 +500,11 @@ export default {
initForm(vm).then(() => { initForm(vm).then(() => {
//rehydrate last form settings //rehydrate last form settings
loadFormSettings(vm); //loadFormSettings(vm);
vm.loading = false; vm.loading = false;
vm.getDataFromApi(); vm.getDataFromApi(vm);
//vm.getDataFromApi();
}); });
} }
}; };
@@ -663,16 +665,32 @@ async function fetchEnums(columnData) {
} }
} }
// /////////////////////////////////
// //
// //
// function initForm(vm) {
// return populatePickLists(vm);
// // //rehydrate last form settings
// // loadFormSettings(vm);
// // vm.loading = false;
// // vm.getDataFromApi();
// }
///////////////////////////////// /////////////////////////////////
// //
// //
function initForm(vm) { function initForm(vm) {
return populatePickLists(vm); return new Promise(function(resolve, reject) {
//If need to call more then...: (async function() {
// .then(() => { try {
// //Must use return here await populatePickLists(vm);
// return initDataObject(vm); await loadFormSettings(vm);
// }); } catch (err) {
reject(err);
}
resolve();
})();
});
} }
//////////////////// ////////////////////
@@ -696,12 +714,12 @@ function populatePickLists(vm) {
// //
// Fetch and cache list view // Fetch and cache list view
// //
async function fetchListView(vm) { function fetchListView(vm) {
//console.log("fetchListView::TOP"); //console.log("fetchListView::TOP");
if (!vm.listViewId) { if (!vm.listViewId) {
return; return;
} }
await window.$gz.api.get("DataListView/" + vm.listViewId).then(res => { return window.$gz.api.get("DataListView/" + vm.listViewId).then(res => {
if (res.error != undefined) { if (res.error != undefined) {
window.$gz.errorHandler.handleFormError(res.error, vm); window.$gz.errorHandler.handleFormError(res.error, vm);
} else { } else {
@@ -757,7 +775,7 @@ function loadFormSettings(vm) {
if (formSettings.saved.itemsPerPage) { if (formSettings.saved.itemsPerPage) {
vm.dataTablePagingOptions.itemsPerPage = formSettings.saved.itemsPerPage; vm.dataTablePagingOptions.itemsPerPage = formSettings.saved.itemsPerPage;
} }
if (formSettings.saved.dataTable.listViewId != undefined) { if (formSettings.saved.dataTable.listViewId != null) {
vm.listViewId = formSettings.saved.dataTable.listViewId; vm.listViewId = formSettings.saved.dataTable.listViewId;
} }
if (vm.listViewId == 0) { if (vm.listViewId == 0) {
@@ -767,7 +785,7 @@ function loadFormSettings(vm) {
if (vm.listViewId == -1) { if (vm.listViewId == -1) {
//-1 is code for unsaved list view //-1 is code for unsaved list view
//check if there is a local copy of a listview vm was edited but not saved //check if there is a local copy of a listview vm was edited but not saved
if (formSettings.saved.dataTable.unsavedListView != undefined) { if (formSettings.saved.dataTable.unsavedListView != null) {
//add UNSAVED FILTER if -1 //add UNSAVED FILTER if -1
vm.pickLists.listViews.unshift({ vm.pickLists.listViews.unshift({
@@ -802,9 +820,7 @@ function loadFormSettings(vm) {
vm.listView = formSettings.temp.dataTable.cachedListView; vm.listView = formSettings.temp.dataTable.cachedListView;
} else { } else {
//fetch it and cache it //fetch it and cache it
(async function() { return fetchListView(vm, vm.listViewId);
await fetchListView(vm, vm.listViewId);
})();
} }
} }
} }

View File

@@ -852,7 +852,7 @@ export default {
//Set some values that otherwise don't get updated because we're not really navigating fresh //Set some values that otherwise don't get updated because we're not really navigating fresh
vm.obj.name = res.data.name; vm.obj.name = res.data.name;
vm.obj.concurrencyToken = res.data.concurrencyToken; vm.obj.concurrencyToken = res.data.concurrencyToken;
vm.obj.listViewId = res.data.id; vm.listViewId = res.data.id;
//Navigate to new record //Navigate to new record
//NOTE: this doesn't really update the form at all so need to set some th9ings //NOTE: this doesn't really update the form at all so need to set some th9ings
vm.$router.push( vm.$router.push(