From f0ce072dfb82c3c475ac5355629e269b0679d7b3 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Aug 2017 15:37:45 -0300 Subject: [PATCH] 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 --- .../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 b065a35524..9a04036dd8 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.13.4