From bbcc17b06452016321f6c7e7b6c629a47fe3fcdb Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Wed, 6 May 2026 22:09:36 -0500 Subject: [PATCH] fix: add basic "Show Totals" feature for main index grids subclass must define what to display --- .../templates/grids/vue_template.mako | 6 ++ src/wuttaweb/templates/master/index.mako | 24 ++++++ src/wuttaweb/views/master.py | 84 ++++++++++++++++++- tests/views/test_master.py | 20 +++++ 4 files changed, 133 insertions(+), 1 deletion(-) diff --git a/src/wuttaweb/templates/grids/vue_template.mako b/src/wuttaweb/templates/grids/vue_template.mako index aaa19fd..3d58e7e 100644 --- a/src/wuttaweb/templates/grids/vue_template.mako +++ b/src/wuttaweb/templates/grids/vue_template.mako @@ -328,6 +328,7 @@ const ${grid.vue_component} = { template: '#${grid.vue_tagname}-template', + mixins: [WuttaRequestMixin], computed: { recordCount() { @@ -658,8 +659,13 @@ // fetch new data params.filter = true this.fetchData(params) + ## nb. this is used for "show totals" feature in master/index template + this.appliedFiltersHook() }, + ## nb. for now each grid can have "just one" (or no) hook + appliedFiltersHook() {}, + getFilterParams() { const params = {} for (let filter of this.filters) { diff --git a/src/wuttaweb/templates/master/index.mako b/src/wuttaweb/templates/master/index.mako index 9b3c3c7..bd9aeb9 100644 --- a/src/wuttaweb/templates/master/index.mako +++ b/src/wuttaweb/templates/master/index.mako @@ -31,6 +31,30 @@ ${parent.modify_vue_vars()}