From a932da04c62340a5f403ffca0ffcec5712cec07d Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Wed, 4 Mar 2020 00:02:54 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 3 +++ ayanova/src/components/gz-data-table.vue | 20 +++++++++++++++++++- ayanova/src/views/ay-data-list-view.vue | 9 +++++++-- 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 9b987aba..9d31424f 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -45,6 +45,9 @@ CURRENT TODOs @@@@@@@@@@@ ROADMAP STAGE 1 and 2: todo: grid relative date tokens need to be substituted before query sent to server +todo: when making change to listview filter for saved datalistview and then returning to datatable it's *not* using the latest changes + - maybe it thinks because it has an ID and that ID is the same that it doesn't need to refresh? + - or maybe the cached local copy of that datalistview is not set (if there is one for saved dlv?) todo: Make functional user settings form with all overrides so can test shit out diff --git a/ayanova/src/components/gz-data-table.vue b/ayanova/src/components/gz-data-table.vue index fb490fcb..7884f3d4 100644 --- a/ayanova/src/components/gz-data-table.vue +++ b/ayanova/src/components/gz-data-table.vue @@ -514,12 +514,15 @@ export default { //this puts a pin in it then resets it after the fetch is completed var preSelected = [...vm.selected]; + //untokenize ListView date token criteria (if there are any) + var untokenizedListView = untokenizeListView(vm.listView); + window.$gz.api .upsert(vm.apiBaseUrl, { offset: listOptions.Offset, limit: listOptions.Limit, dataListKey: vm.dataListKey, - listView: vm.listView + listView: untokenizedListView }) .then(res => { if (res.error != undefined) { @@ -893,4 +896,19 @@ function loadFormSettings(vm) { } } } + +//////////////////// +// +function untokenizeListView(lv) { + //[{"fld":"widgetname"},{"fld":"widgetstartdate","filter":{"items":[{"op":"=","value":"*past90days*","token":true}]}},{"fld":"widgetenddate"}] + if (lv == null) { + return lv; + } + //See if it has any date tokens + if (lv.indexOf('"token":true') == -1) { + return; + } + console.log(lv); + console.log(JSON.parse(lv)); +} diff --git a/ayanova/src/views/ay-data-list-view.vue b/ayanova/src/views/ay-data-list-view.vue index 3f6b7344..66563ff3 100644 --- a/ayanova/src/views/ay-data-list-view.vue +++ b/ayanova/src/views/ay-data-list-view.vue @@ -635,6 +635,7 @@ export default { if (item.tempFilterToken && item.tempFilterToken != "*select*") { //special relative token filterItem.op = "="; //equality + filterItem.token = true; filterItem.value = item.tempFilterToken; filterItemSet = true; } @@ -1526,10 +1527,14 @@ function generateListViewFromEdited(vm) { } for (var j = 0; j < ev.filter.items.length; j++) { var evfi = ev.filter.items[j]; - f.items.push({ + var thisFilterItem = { op: evfi.op, value: evfi.value - }); + }; + if (evfi.token) { + thisFilterItem.token = true; + } + f.items.push(thisFilterItem); } o.filter = f; }