From 6087ea864c171ae94c753e90795a8ca0394140eb Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Tue, 25 Feb 2020 00:16:19 +0000 Subject: [PATCH] --- ayanova/src/components/gz-data-table.vue | 46 ++++++++++++++++-------- ayanova/src/views/ay-data-list-view.vue | 2 +- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index c3063297..57a4143e 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -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); } } } diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index 961633ae..1436a3b4 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -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(