diff --git a/docs/option/scroller.label.xml b/docs/option/scroller.label.xml new file mode 100644 index 0000000..61a546c --- /dev/null +++ b/docs/option/scroller.label.xml @@ -0,0 +1,32 @@ + + + scroller.label + Display a label while user is scrolling with the scrollbar + + + + * `true` show the label when scrolling + * `false` do not show + + + + + Label is displayed when scrolling using the scrollbar + + + + While scrolling using the scrollbar, a label is displayed to indicate the user the approximate position displayed within the whole dataset + + + + + diff --git a/js/dataTables.scroller.js b/js/dataTables.scroller.js index fccf653..a469abd 100644 --- a/js/dataTables.scroller.js +++ b/js/dataTables.scroller.js @@ -1,4 +1,4 @@ -/*! Scroller 2.0.1 +/*! Scroller 2.0.2 * ©2011-2019 SpryMedia Ltd - datatables.net/license */ @@ -490,7 +490,10 @@ $.extend( Scroller.prototype, { .append( this.dom.loader ); } - this.dom.label.appendTo(this.dom.scroller); + if ( this.s.label ) + { + this.dom.label.appendTo(this.dom.scroller); + } /* Initial size calculations */ if ( this.s.heights.row && this.s.heights.row != 'auto' ) @@ -521,8 +524,11 @@ $.extend( Scroller.prototype, { that.s.mousedown = true; }) .on('mouseup.dt-scroller', function () { - that.s.mouseup = false; - that.dom.label.css('display', 'none'); + that.s.mouseup = false; + if ( this.s.label ) + { + that.dom.label.css('display', 'none'); + } }); // On resize, update the information element, since the number of rows shown might change @@ -1062,7 +1068,7 @@ $.extend( Scroller.prototype, { this.s.lastScrollTop = iScrollTop; this.s.stateSaveThrottle(); - if ( this.s.scrollType === 'jump' && this.s.mousedown ) { + if ( this.s.scrollType === 'jump' && this.s.mousedown && this.s.label ) { this.dom.label .html( this.s.dt.fnFormatNumber( parseInt( this.s.topRowFloat, 10 )+1 ) ) .css( 'top', iScrollTop + (iScrollTop * heights.labelFactor ) ) @@ -1170,7 +1176,16 @@ Scroller.defaults = { * @default 200 * @static */ - serverWait: 200 + serverWait: 200, + + /** + * While scrolling using the scrollbar, a label is displayed to indicate the user + * the approximate position displayed within the whole table content + * @type bool + * @default true + * @static + */ + label: true }; Scroller.oDefaults = Scroller.defaults;