diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 3a339815..2fa76fa6 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -180,7 +180,6 @@ export default { //debugger; var that = this; - //DataList/list?DataListKey=TestWidgetDataList&Offset=0&Limit=999&DataFilterId=1&mini=true //start with defaults @@ -228,26 +227,29 @@ export default { 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 - } - }); - } - + //persist the paging options so user sees same page and list on refresh or leave and return scenario + window.$gz.form.setFormSettings(that.formKey, { + temp: { page: that.dataTablePagingOptions.page }, + saved: { + itemsPerPage: that.dataTablePagingOptions.itemsPerPage + } + }); + ////////// })(); }); } + }, + created() { + //rehydrate last form settings + var formSettings = window.$gz.form.getFormSettings(this.formKey); + if (formSettings.saved && formSettings.saved.itemsPerPage) { + this.dataTablePagingOptions.itemsPerPage = + formSettings.saved.itemsPerPage; + } + if (formSettings.temp && formSettings.temp.page) { + this.dataTablePagingOptions.page = formSettings.temp.page; + } } };