From 6bee65780ca73ceb2f44215685d97362f734858b Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Thu, 25 Apr 2024 22:00:01 -0500 Subject: [PATCH] Improve logic for Add Filter grid button/autocomplete this should work for oruga as well as buefy --- tailbone/templates/grids/complete.mako | 8 ++++++++ tailbone/templates/grids/filters.mako | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/tailbone/templates/grids/complete.mako b/tailbone/templates/grids/complete.mako index 940174dc..cb040cc4 100644 --- a/tailbone/templates/grids/complete.mako +++ b/tailbone/templates/grids/complete.mako @@ -294,6 +294,7 @@ computed: { addFilterChoices() { + // nb. this returns all choices available for "Add Filter" operation // collect all filters, which are *not* already shown let choices = [] @@ -354,6 +355,13 @@ methods: { + formatAddFilterItem(filtr) { + if (!filtr.key) { + filtr = this.filters[filtr] + } + return filtr.label || filtr.key + }, + % if grid.click_handlers: cellClick(row, column, rowIndex, columnIndex) { % for key in grid.click_handlers: diff --git a/tailbone/templates/grids/filters.mako b/tailbone/templates/grids/filters.mako index eb245934..cb6ec9e2 100644 --- a/tailbone/templates/grids/filters.mako +++ b/tailbone/templates/grids/filters.mako @@ -32,7 +32,7 @@ v-model="addFilterTerm" placeholder="Add Filter" field="key" - :custom-formatter="filtr => filtr.label" + :custom-formatter="formatAddFilterItem" open-on-focus keep-first icon-pack="fas"