From 6abb5360093568ca0ad3bd9574b0e748b80a4c49 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 8 Feb 2021 18:25:31 +0000 Subject: [PATCH] --- ayanova/devdocs/todo.txt | 8 ++------ .../components/data-table-filter-control.vue | 20 ++++++++++++++++--- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ayanova/devdocs/todo.txt b/ayanova/devdocs/todo.txt index 331c0423..eb7b09b4 100644 --- a/ayanova/devdocs/todo.txt +++ b/ayanova/devdocs/todo.txt @@ -7,7 +7,8 @@ MISC ITEMS THAT CAME UP - +todo: tagpicker, don't like how it works, it's funky to enter multiple tags and input doesn't go away when you select it just leaves the typed text there + once a selection is made it should not repeat the typed text again, it shoudl be ready to type another tag from start LISTVIEW REPLACE CURRENT <----HERE not THERE ---v @@ -15,11 +16,6 @@ LISTVIEW REPLACE CURRENT <----HERE not THERE ---v TODO (now) -Tag filter: "[{\"column\":\"customertags\",\"any\":false,\"items\":[{\"op\":\"=\",\"value\":[\"orange\"]}]}]" -Error: >Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: [. Path '[0].items[0].value', line 1, position 66. - -Issue is because the "value" of tags filter is an array but c# expects a single string in the value columnm, so turn it into a comma delimited list instead and -then adjust the server code to handle it todo (after) Test TEST **TEST** diff --git a/ayanova/src/components/data-table-filter-control.vue b/ayanova/src/components/data-table-filter-control.vue index bf64b82d..d388428b 100644 --- a/ayanova/src/components/data-table-filter-control.vue +++ b/ayanova/src/components/data-table-filter-control.vue @@ -379,9 +379,15 @@ export default { items: [] }; this.editItem.filter.items.forEach(function(z) { + //de-arrayify tag filters + let filterValue = z.value; + if (Array.isArray(filterValue)) { + filterValue = z.value.join(); //array to string + } + newColumnFilter.items.push({ op: z.op, - value: z.value + value: filterValue }); }); @@ -467,6 +473,7 @@ export default { ) { filterItem.op = editItem.tempFilterOperator; filterItem.value = editItem.tempFilterValue; + //only add if there is both an op and a value //above here for tokens that isn't a restriction but //after passing through those conditions were at a point where there MUST be both @@ -869,8 +876,15 @@ editItemFilter:{ "any": false, "items": [] } } //If it's a tag and it's not been set yet it needs to have an empty array to stat with for the picker - if (o.uiFieldDataType == 9 && o.tempFilterValue == null) { - o.tempFilterValue = []; + //otherwise it needs to be converted to an array from a comma delimited string for the picker as well + if (o.uiFieldDataType == 9) { + if (o.tempFilterValue == null) { + o.tempFilterValue = []; + } else { + //should be a comma delimited string, turn into array + console.log("nitEditItem tag filter items=", o.filter.items); + o.tempFilterValue = o.filter.items[0].split(","); + } } //Add display text for filter item (same as in addFilterCondition)