diff --git a/ayanova/src/api/gzapi.js b/ayanova/src/api/gzapi.js index d6869cd8..a4018d74 100644 --- a/ayanova/src/api/gzapi.js +++ b/ayanova/src/api/gzapi.js @@ -27,6 +27,7 @@ function devShowUnknownError(error) { console.log("gzapi::devShowUnknownError, error is:"); // eslint-disable-next-line console.log(error); + debugger; window.$gz.eventBus.$emit( "notify-warning", diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index 2e030f07..ac501e18 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -284,14 +284,12 @@ export default { props: { apiBaseUrl: { type: String, - default: "DataList/List" + default: "DataList" }, formKey: String, dataListKey: String, - dataFilterId: { - type: Number, - default: 0 - }, + dataListSort: String, + dataListFilter: String, showSelect: { type: Boolean, default: false @@ -377,34 +375,52 @@ export default { that.loading = true; - var listUrl = - that.apiBaseUrl + "?" + window.$gz.api.buildQuery(listOptions); - window.$gz.api.get(listUrl).then(res => { - //NOTE: This is how to call an async function and await it from sync code - (async function() { - //Save a copy of the server columns data for handling button clicks etc later - that.serverColumns = res.columns; - //Make sure the locale keys are fetched - await fetchLocalizedHeaderNames(res.columns); //Note can use await here because it's wrapped inside an async function call, it will wait then resume next stuff below - await fetchEnums(res.columns); - //build that.headers here - that.headers = buildHeaders(res.columns); - //Post process data here and then set that.records - that.records = buildRecords(res.data, res.columns); - that.loading = false; - that.totalRecords = res.totalRecordCount; + // var listUrl = + // that.apiBaseUrl + "?" + window.$gz.api.buildQuery(listOptions); - //persist the paging options so user sees same page and list on refresh or leave and return scenario + // { + // "offset": 0, + // "limit": 0, + // "mini": true, + // "dataListKey": "string", + // "filterJson": "string", + // "sortJson": "string" + // } - window.$gz.form.setFormSettings(that.formKey, { - temp: { page: that.dataTablePagingOptions.page }, - saved: { - itemsPerPage: that.dataTablePagingOptions.itemsPerPage - } - }); - ////////// - })(); - }); + window.$gz.api + .upsert(that.apiBaseUrl, { + offset: listOptions.Offset, + limit: listOptions.Limit, + dataListKey: that.dataListKey, + filterJson: that.dataListFilter, + sortJson: that.dataListSort + }) + .then(res => { + //NOTE: This is how to call an async function and await it from sync code + (async function() { + //Save a copy of the server columns data for handling button clicks etc later + that.serverColumns = res.columns; + //Make sure the locale keys are fetched + await fetchLocalizedHeaderNames(res.columns); //Note can use await here because it's wrapped inside an async function call, it will wait then resume next stuff below + await fetchEnums(res.columns); + //build that.headers here + that.headers = buildHeaders(res.columns); + //Post process data here and then set that.records + that.records = buildRecords(res.data, res.columns); + that.loading = false; + that.totalRecords = res.totalRecordCount; + + //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() { diff --git a/ayanova/src/router.js b/ayanova/src/router.js index 9a58a786..ebcfc24e 100644 --- a/ayanova/src/router.js +++ b/ayanova/src/router.js @@ -400,6 +400,12 @@ export default new Router({ component: () => import(/* webpackChunkName: "ay" */ "./views/ay-customize.vue") }, + { + path: "/ay-sort-filter/:recordid/:dataListKey", + name: "ay-sort-filter", + component: () => + import(/* webpackChunkName: "ay" */ "./views/ay-sort-filter.vue") + }, { path: "/ay-attachments/:ayatype/:recordid", name: "ay-attachments", diff --git a/ayanova/src/views/ay-sort-filter.vue b/ayanova/src/views/ay-sort-filter.vue new file mode 100644 index 00000000..fea562c4 --- /dev/null +++ b/ayanova/src/views/ay-sort-filter.vue @@ -0,0 +1,383 @@ + +