Skip to content

Commit

Permalink
Fix: Sizing table was incorrectly including DataTables hidden columns
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanJard committed Apr 12, 2024
1 parent 5cef001 commit 9828377
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions js/dataTables.responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,8 +1091,7 @@ $.extend(Responsive.prototype, {
emptyRow.append('<td/>');
}

// Body rows - we don't need to take account of DataTables' column
// visibility since we implement our own here (hence the `display` set)
// Body rows
dt.rows({ page: 'current' }).every(function (rowIdx) {
var node = this.node();

Expand All @@ -1103,7 +1102,7 @@ $.extend(Responsive.prototype, {
// We clone the table's rows and cells to create the sizing table
var tr = node.cloneNode(false);

dt.cells(rowIdx, '*').every(function (rowIdx2, colIdx) {
dt.cells(rowIdx, visibleColumns).every(function (rowIdx2, colIdx) {
// If nodes have been moved out (listHiddenNodes), we need to
// clone from the store
var store = that.s.childNodeStore[rowIdx + '-' + colIdx];
Expand All @@ -1121,6 +1120,8 @@ $.extend(Responsive.prototype, {
clonedBody.append(tr);
});

// Any cells which were hidden by Responsive in the host table, need to
// be visible here for the calculations
clonedBody.find('th, td').css('display', '');

// Footer
Expand Down

0 comments on commit 9828377

Please sign in to comment.