Bug 33736: Ensure datatable filter row takes visible into account

We clone the header row, and then iterate it assuming the iterator index
lines up with the column definition index of the datatables settings.

However, if a column is hidden, this is not the case. Said column will
not appear in the header row that's cloned and as such your iterator
will no longer line up with the column settings index number of the
settings array.

Sponsored-by: PTFS Europe Ltd
Signed-off-by: Esther Melander <esther@bywatersolutions.com>
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Martin Renvoize 2024-10-16 10:38:32 +01:00 committed by Katrin Fischer
parent 6392f90b5f
commit 025ed2d09a
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 6 additions and 0 deletions

View File

@ -830,7 +830,13 @@ function _dt_on_visibility(add_filters, table_node, table_dt){
function _dt_add_filters(table_node, table_dt, filters_options = {}) {
$(table_node).find('thead tr').clone().appendTo( $(table_node).find('thead') );
let j = -1;
$(table_node).find('thead tr:eq(1) th').each( function (i) {
j++
var is_visible = table_dt.settings()[0].aoColumns[j].bVisible;
if ( !is_visible ) { j++ }
i = j;
var is_searchable = table_dt.settings()[0].aoColumns[i].bSearchable;
$(this).removeClass('sorting').removeClass("sorting_asc").removeClass("sorting_desc");
$(this).data('th-id', i);