Skip to content

Commit

Permalink
Fix: When the horizontal scrollbar is shown, the position label being…
Browse files Browse the repository at this point in the history
… shown could allow the table to be overscrolled

DD-1940
https://datatables.net/forums/discussion/67987
  • Loading branch information
AllanJard committed Apr 22, 2021
1 parent 33bf004 commit 3ffb62c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions js/dataTables.scroller.js
Expand Up @@ -216,7 +216,8 @@ var Scroller = function ( dt, opts ) {
* @default 0
*/
viewport: null,
labelFactor: 1
labelFactor: 1,
labelHeight: 0,
},

topRowFloat: 0,
Expand Down Expand Up @@ -295,7 +296,9 @@ $.extend( Scroller.prototype, {
}

var label = this.dom.label.outerHeight();
heights.labelFactor = (heights.viewport-label) / heights.scroll;
var xbar = this.dom.scroller.offsetHeight - this.dom.scroller.clientHeight;
heights.labelHeight = label;
heights.labelFactor = (heights.viewport-label - xbar) / heights.scroll;

if ( redraw === undefined || redraw )
{
Expand Down Expand Up @@ -1068,7 +1071,7 @@ $.extend( Scroller.prototype, {
if (this.s.labelVisible) {
this.dom.label
.html( this.s.dt.fnFormatNumber( parseInt( this.s.topRowFloat, 10 )+1 ) )
.css( 'top', iScrollTop + (iScrollTop * heights.labelFactor ) )
.css( 'top', iScrollTop + (iScrollTop * heights.labelFactor) )
.css( 'display', 'block' );
}
},
Expand Down

0 comments on commit 3ffb62c

Please sign in to comment.