From 350f831181fa4a0befd4f8a80e5381409413e0c1 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 31 Jan 2020 16:07:22 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 1 - ayanova/src/api/gzform.js | 3 +- ayanova/src/components/gz-data-table.vue | 47 ++++++++++++------------ 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 22fab52f..afd18845 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -48,7 +48,6 @@ CURRENT TODOs SHELL / NAV / MENUS / LAYOUT -TODO: Test single select still wroking after recent changes TODO: Save grid settings on paging changes, when open grid get last paging so editing records doesn't lose your position when you come back - Also scrollposition TODO: toolbar above grid for filters, refresh etc (make it a standard component?) diff --git a/ayanova/src/api/gzform.js b/ayanova/src/api/gzform.js index 5aa8d9bd..9bd979e3 100644 --- a/ayanova/src/api/gzform.js +++ b/ayanova/src/api/gzform.js @@ -649,7 +649,8 @@ export default { // for form specified or empty object if there is none // EAch form is responsible for what it stores and how it initializes, this just provides that // the form does the actual work of what settings it requires - // Form settings are temp and saved, saved ones go into vuex and localstorage and temporary ones are stored in session storage + // Form settings are temp and saved, saved ones go into vuex and localstorage and persist a refresh + // and temporary ones are stored in session storage and don't persist a refresh // getFormSettings(formKey) { return { diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index e315ebb1..3a339815 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -5,7 +5,7 @@ :headers="headers" :items="records" v-model="selected" - :options.sync="options" + :options.sync="dataTablePagingOptions" :server-items-length="totalRecords" :loading="loading" :disable-sort="true" @@ -98,7 +98,7 @@ export default { data() { return { loading: true, - options: {}, + dataTablePagingOptions: {}, headers: [], serverColumns: [], totalRecords: 0, @@ -129,7 +129,7 @@ export default { } }, watch: { - options: { + dataTablePagingOptions: { handler() { this.getDataFromApi(); }, @@ -165,8 +165,6 @@ export default { //i is the actual AyaNova index of that record so we have all we need to open that object window.$gz.eventBus.$emit("openobject", { type: typeToOpen, id: i }); - // this.$emit("OPENOBJECT", { type: typeToOpen, id: i }); - // alert("STUB: Open object type " + typeToOpen + " with record id of " + i); }, lt(ltKey) { return window.$gz.locale.get(ltKey); @@ -182,22 +180,7 @@ export default { //debugger; var that = this; - // //set the list settings in the store since we were successful at retrieval - // if ( - // that.localFormSettings && - // that.localFormSettings.pagination && - // that.localFormSettings.pagination.itemsPerPage - // ) { - // window.$gz.form.setFormSettings(that.formKey, { - // temp: { page: that.localFormSettings.pagination.page }, - // saved: { - // itemsPerPage: that.localFormSettings.pagination.itemsPerPage, - // sortBy: that.localFormSettings.pagination.sortBy, - // descending: that.localFormSettings.pagination.descending - // } - // }); - // } - + //DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=999&DataFilterId=1&mini=true //start with defaults @@ -207,7 +190,7 @@ export default { Offset: 0 }; //calculate paging based on settings - const { page, itemsPerPage } = that.options; + const { page, itemsPerPage } = that.dataTablePagingOptions; if (itemsPerPage && itemsPerPage > 0) { listOptions.Offset = (page - 1) * itemsPerPage; listOptions.Limit = itemsPerPage; @@ -240,10 +223,28 @@ export default { that.records = buildRecords( res.data, res.columns, - that.$options.filters + that.$options.filters //this is the VUE filters collection, nothing to do with the local data structure ); that.loading = false; that.totalRecords = res.paging.count; + + //set the list settings in the store since we were successful at retrieval + if ( + that.localFormSettings && + that.localFormSettings.pagination && + that.localFormSettings.pagination.itemsPerPage + ) { + window.$gz.form.setFormSettings(that.formKey, { + temp: { page: that.localFormSettings.pagination.page }, + saved: { + itemsPerPage: that.localFormSettings.pagination.itemsPerPage, + sortBy: that.localFormSettings.pagination.sortBy, + descending: that.localFormSettings.pagination.descending + } + }); + } + + })(); }); }