Skip to content

Commit

Permalink
c5876413be0fdb125cb0e05db5c2ca770a436a1b Dev: Tweak to auto column wi…
Browse files Browse the repository at this point in the history
…dth updating - need to account for the container being hidden, but having a resolvable width

Sync to source repo @c5876413be0fdb125cb0e05db5c2ca770a436a1b
  • Loading branch information
dtbuild committed Jan 6, 2025
1 parent c274f08 commit eaff715
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 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/DataTablesSrc",
"last-tag": "2.1.8",
"last-sync": "5a05ebd839add77d82207f90478871cb3c69546c"
"last-sync": "c5876413be0fdb125cb0e05db5c2ca770a436a1b"
}
10 changes: 8 additions & 2 deletions js/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -5536,10 +5536,16 @@
}

if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
settings.containerWidth = $(settings.nTableWrapper).width();
var wrapperWidth = function () {
return $(settings.nTableWrapper).is(':visible')
? $(settings.nTableWrapper).width()
: 0;
}

settings.containerWidth = wrapperWidth();

var resize = DataTable.util.throttle( function () {
var newWidth = $(settings.nTableWrapper).width();
var newWidth = wrapperWidth();

// Don't do it if destroying, is the same size as last time, or the container
// width is 0
Expand Down
2 changes: 1 addition & 1 deletion js/dataTables.min.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

10 changes: 8 additions & 2 deletions js/dataTables.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5483,10 +5483,16 @@ function _fnCalculateColumnWidths ( settings )
}

if ( (tableWidthAttr || scrollX) && ! settings._reszEvt ) {
settings.containerWidth = $(settings.nTableWrapper).width();
var wrapperWidth = function () {
return $(settings.nTableWrapper).is(':visible')
? $(settings.nTableWrapper).width()
: 0;
}

settings.containerWidth = wrapperWidth();

var resize = DataTable.util.throttle( function () {
var newWidth = $(settings.nTableWrapper).width();
var newWidth = wrapperWidth();

// Don't do it if destroying, is the same size as last time, or the container
// width is 0
Expand Down

0 comments on commit eaff715

Please sign in to comment.