From 9c987f37c6ad0839cd63062b6244be0e12a367e9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 17 Dec 2024 10:12:21 +0100 Subject: [PATCH] Bug 38724: Do not show the filters when updating col vis (if not needed) (In reply to Brendan Lawlor from bug 38632 comment #7) > During testing I noticed small related bug in current main. On the > bibliographic record details page if you click to configure columns and you > add or remove a column it automatically shows the column filters too, but it > does not toggle the filter link to 'Hide filters` so you have to click twice > to hide them. Signed-off-by: Brendan Lawlor --- .../html_helpers/tables/items/catalogue_detail.inc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc index f6ce0667c3..6f586bad2a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc @@ -173,6 +173,7 @@ }); + let filters_shown = false; $(document).ready(function() { $(".show_filters").on("click",function(e){ e.preventDefault(); @@ -180,6 +181,7 @@ let tab = $("#" + tab_id + "_panel" ); tab.find(".show_filters").hide(); tab.find(".hide_filters").show(); + filters_show = true; $("#"+tab_id+"_table thead tr:eq(1)").remove(); build_items_table(tab_id, true, { destroy: true }, build_items_table_drawncallback ); itemSelectionBuildActionLinks(tab_id); @@ -191,6 +193,7 @@ let tab = $("#" + tab_id + "_panel" ); tab.find(".hide_filters").hide(); tab.find(".show_filters").show(); + filters_show = false; $("#"+tab_id+"_table thead tr:eq(1)").remove(); build_items_table(tab_id, false, { destroy: true }, build_items_table_drawncallback ); itemSelectionBuildActionLinks(tab_id); @@ -868,7 +871,9 @@ table_dt.on("column-visibility.dt", function(e, settings, column, state, recalc ){ if (recalc === false) return; - _dt_add_filters(this, table_dt, filters_options); + if ( filters_shown ) { + _dt_add_filters(this, table_dt, filters_options); + } user_colvis[tab_id][column] = state; -- 2.39.5