Skip to content

Commit

Permalink
46bf228318d87acfc0d3d96d843129ebaac0cb86 Fix: Check that the paging c…
Browse files Browse the repository at this point in the history
…ontrol has any width before triggering reponsive control

DataTables/DataTablesSrc#295

Sync to source repo @46bf228318d87acfc0d3d96d843129ebaac0cb86
  • Loading branch information
dtbuild committed Oct 7, 2024
1 parent 155c47b commit d32151e
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 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": "643377800fbf3b1e050b8d59a843837710aea693"
"last-sync": "46bf228318d87acfc0d3d96d843129ebaac0cb86"
}
5 changes: 4 additions & 1 deletion js/dataTables.js
Original file line number Diff line number Diff line change
Expand Up @@ -13295,10 +13295,13 @@

// Responsive - check if the buttons are over two lines based on the
// height of the buttons and the container.
var outerWidth = $(buttonEls[0]).outerHeight();

if (
buttonEls.length && // any buttons
opts.buttons > 1 && // prevent infinite
$(host).height() >= ($(buttonEls[0]).outerHeight() * 2) - 10
outerWidth > 0 && // will be 0 if hidden
$(host).height() >= (outerWidth * 2) - 10
) {
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 }));
}
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.

5 changes: 4 additions & 1 deletion js/dataTables.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13242,10 +13242,13 @@ function _pagingDraw(settings, host, opts) {

// Responsive - check if the buttons are over two lines based on the
// height of the buttons and the container.
var outerWidth = $(buttonEls[0]).outerHeight();

if (
buttonEls.length && // any buttons
opts.buttons > 1 && // prevent infinite
$(host).height() >= ($(buttonEls[0]).outerHeight() * 2) - 10
outerWidth > 0 && // will be 0 if hidden
$(host).height() >= (outerWidth * 2) - 10
) {
_pagingDraw(settings, host, $.extend({}, opts, { buttons: opts.buttons - 2 }));
}
Expand Down

0 comments on commit d32151e

Please sign in to comment.