From fbff85773fd00aede6f791fc439eec4426707014 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 13 Apr 2023 16:09:59 +0200 Subject: [PATCH] Bug 33568: fix DataTables bKohaColumnsUseNames MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Looks like this bug does not exist in Koha, but we hit it here. Could be moved to its own bug. Compare with ../includes/columns_settings.inc (code that is used prior to this change) Signed-off-by: Owen Leonard Signed-off-by: Laurence Rault Signed-off-by: Emily Lamancusa Signed-off-by: Tomás Cohen Arazi Signed-off-by: Katrin Fischer --- koha-tmpl/intranet-tmpl/prog/js/datatables.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js index e03c0c2a3e..323b21d7e1 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js +++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js @@ -780,14 +780,15 @@ function _dt_buttons(params){ return buttons; } -function _dt_visibility(table_settings, settings){ +function _dt_visibility(node, table_settings, settings){ var counter = 0; let hidden_ids = []; let included_ids = []; if ( table_settings ) { var columns_settings = table_settings['columns']; $(columns_settings).each( function() { - var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', this ).index( 'th' ); + let selector = '#' + node.attr('id'); + var named_id = $( 'thead th[data-colname="' + this.columnname + '"]', selector ).index( selector + ' th' ); var used_id = settings.bKohaColumnsUseNames ? named_id : counter; if ( used_id == -1 ) return; @@ -974,7 +975,7 @@ function _dt_add_delay(table_dt, table_node, delay_ms) { } let hidden_ids, included_ids; - [hidden_ids, included_ids] = _dt_visibility(table_settings, settings) + [hidden_ids, included_ids] = _dt_visibility(this, table_settings, settings) settings["buttons"] = _dt_buttons({included_ids, settings, table_settings}); -- 2.39.5