Skip to content

Commit

Permalink
9828377f157cb25b239a4dd95e218e23373aed16 Fix: Sizing table was incorr…
Browse files Browse the repository at this point in the history
…ectly including DataTables hidden columns

Sync to source repo @9828377f157cb25b239a4dd95e218e23373aed16
  • Loading branch information
dtbuild committed Apr 12, 2024
1 parent 10a5877 commit 6d79db1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion datatables.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
],
"src-repo": "http://github.com/DataTables/Responsive",
"last-tag": "3.0.1",
"last-sync": "5cef001d85ad066031fb4febbbca666f9eadc533"
"last-sync": "9828377f157cb25b239a4dd95e218e23373aed16"
}
7 changes: 4 additions & 3 deletions js/dataTables.responsive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,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 @@ -1150,7 +1149,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 @@ -1168,6 +1167,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
2 changes: 1 addition & 1 deletion js/dataTables.responsive.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/dataTables.responsive.min.mjs

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions js/dataTables.responsive.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1098,8 +1098,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 @@ -1110,7 +1109,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 @@ -1128,6 +1127,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 6d79db1

Please sign in to comment.