From 2211b0a886bedb9fe84e9472477ca6c45aa5db40 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Aug 2017 15:37:45 -0300 Subject: [PATCH] [SIGNED-OFF] Bug 16759: (followup) Make it work with OpacSeparateHoldings This patch fixes columns_settings.inc so it works for all objects when the selector returns more than one object. To test: - Have the first patch applied - Verify it works correctly - Enable OpacSeparateHoldings - Reload => FAIL: Notice the second holdings tab doesn't have the visualization rules applied. - Apply this patch - Reload => SUCCESS: Rules applied correctly! - Sign off :-D Edit: amended so it preserves the original semantic, returning the resulting table objects. Sponsored-by: Dover Signed-off-by: Owen Leonard --- .../opac-tmpl/bootstrap/en/includes/columns_settings.inc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc index b065a35..9a04036 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/columns_settings.inc @@ -25,13 +25,16 @@ function KohaTable(selector, dt_parameters, columns_settings) { text: _("Column visibility"), } ]; - var table = $(selector).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters)); - $(hidden_ids).each(function(index, value) { - table.fnSetColumnVis( value, false ); + var tables = $(selector).map(function(){ + var table = $(this).dataTable($.extend(true, {}, dataTablesDefaults, dt_parameters)); + $(hidden_ids).each(function(index, value) { + table.fnSetColumnVis(value, false); + }); + return table; }); - return table; + return tables; } -- 2.1.4