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(() => {
//rehydrate last form settings
loadFormSettings(vm);
//loadFormSettings(vm);
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) {
return populatePickLists(vm);
//If need to call more then...:
// .then(() => {
// //Must use return here
// return initDataObject(vm);
// });
return new Promise(function(resolve, reject) {
(async function() {
try {
await populatePickLists(vm);
await loadFormSettings(vm);
} catch (err) {
reject(err);
}
resolve();
})();
});
}
////////////////////
@@ -696,12 +714,12 @@ function populatePickLists(vm) {
//
// Fetch and cache list view
//
async function fetchListView(vm) {
function fetchListView(vm) {
//console.log("fetchListView::TOP");
if (!vm.listViewId) {
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) {
window.$gz.errorHandler.handleFormError(res.error, vm);
} else {
@@ -757,7 +775,7 @@ function loadFormSettings(vm) {
if (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;
}
if (vm.listViewId == 0) {
@@ -767,7 +785,7 @@ function loadFormSettings(vm) {
if (vm.listViewId == -1) {
//-1 is code for unsaved list view
//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
vm.pickLists.listViews.unshift({
@@ -802,9 +820,7 @@ function loadFormSettings(vm) {
vm.listView = formSettings.temp.dataTable.cachedListView;
} else {
//fetch it and cache it
(async function() {
await fetchListView(vm, vm.listViewId);
})();
return 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
vm.obj.name = res.data.name;
vm.obj.concurrencyToken = res.data.concurrencyToken;
vm.obj.listViewId = res.data.id;
vm.listViewId = res.data.id;
//Navigate to new record
//NOTE: this doesn't really update the form at all so need to set some th9ings
vm.$router.push(