Bug 33568: fix DataTables bKohaColumnsUseNames

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 <oleonard@myacpl.org>

Signed-off-by: Laurence Rault <laurence.rault@biblibre.com>
Signed-off-by: Emily Lamancusa <emily.lamancusa@montgomerycountymd.gov>
Signed-off-by: Tomás Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Jonathan Druart 2023-04-13 16:09:59 +02:00 committed by Katrin Fischer
parent 45de46d3d0
commit fbff85773f
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 4 additions and 3 deletions

View File

@ -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});