datatables.net-scroller
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -1,3 +0,3 @@ | ||
/*! Scroller 1.4.0 | ||
* ©2011-2015 SpryMedia Ltd - datatables.net/license | ||
/*! Scroller 1.4.1 | ||
* ©2011-2016 SpryMedia Ltd - datatables.net/license | ||
*/ | ||
@@ -8,7 +8,7 @@ | ||
* @description Virtual rendering for DataTables | ||
* @version 1.4.0 | ||
* @version 1.4.1 | ||
* @file dataTables.scroller.js | ||
* @author SpryMedia Ltd (www.sprymedia.co.uk) | ||
* @contact www.sprymedia.co.uk/contact | ||
* @copyright Copyright 2011-2015 SpryMedia Ltd. | ||
* @copyright Copyright 2011-2016 SpryMedia Ltd. | ||
* | ||
@@ -435,5 +435,7 @@ * This source file is free software, available under the following license: | ||
heights.viewport = $(this.dom.scroller).height(); | ||
this.s.viewportRows = parseInt( heights.viewport / heights.row, 10 )+1; | ||
this.s.dt._iDisplayLength = this.s.viewportRows * this.s.displayBuffer; | ||
if ( heights.row ) { | ||
heights.viewport = $(this.dom.scroller).height(); | ||
this.s.viewportRows = parseInt( heights.viewport / heights.row, 10 )+1; | ||
this.s.dt._iDisplayLength = this.s.viewportRows * this.s.displayBuffer; | ||
} | ||
@@ -447,3 +449,27 @@ if ( bRedraw === undefined || bRedraw ) | ||
/** | ||
* Get information about current displayed record range. This corresponds to | ||
* the information usually displayed in the "Info" block of the table. | ||
* | ||
* @returns {object} info as an object: | ||
* { | ||
* start: {int}, // the 0-indexed record at the top of the viewport | ||
* end: {int}, // the 0-indexed record at the bottom of the viewport | ||
* } | ||
*/ | ||
"fnPageInfo": function() | ||
{ | ||
var | ||
dt = this.s.dt, | ||
iScrollTop = this.dom.scroller.scrollTop, | ||
iTotal = dt.fnRecordsDisplay(), | ||
iPossibleEnd = Math.ceil(this.fnPixelsToRow(iScrollTop + this.s.heights.viewport, false, this.s.ani)); | ||
return { | ||
start: Math.floor(this.fnPixelsToRow(iScrollTop, false, this.s.ani)), | ||
end: iTotal < iPossibleEnd ? iTotal-1 : iPossibleEnd-1 | ||
}; | ||
}, | ||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | ||
@@ -562,3 +588,7 @@ * Private methods (they are of course public in JS, but recommended as private) | ||
$(this.s.dt.nTable).on( 'init.dt', function () { | ||
// Measure immediately. Scroller will have been added using preInit, so | ||
// we can reliably do this here. We could potentially also measure on | ||
// init complete, which would be useful for cases where the data is Ajax | ||
// loaded and longer than a single line. | ||
$(this.s.dt.nTable).one( 'init.dt', function () { | ||
that.fnMeasure(); | ||
@@ -861,6 +891,8 @@ } ); | ||
// take precedence over the one we want here. So a 'thread' break is | ||
// needed | ||
setTimeout( function () { | ||
that._fnInfo.call( that ); | ||
}, 0 ); | ||
// needed. Only add the thread break if bInfo is set | ||
if ( this.s.dt.oFeatures.bInfo ) { | ||
setTimeout( function () { | ||
that._fnInfo.call( that ); | ||
}, 0 ); | ||
} | ||
@@ -938,3 +970,9 @@ // Hide the loading indicator | ||
// If initialised using `dom`, use the holding element as the insert point | ||
container.appendTo( this.s.dt.nHolding || origTable.parentNode ); | ||
var insertEl = this.s.dt.nHolding || origTable.parentNode; | ||
if ( ! $(insertEl).is(':visible') ) { | ||
insertEl = 'body'; | ||
} | ||
container.appendTo( insertEl ); | ||
this.s.heights.row = $('tr', tbody).eq(1).outerHeight(); | ||
@@ -1182,3 +1220,3 @@ | ||
*/ | ||
Scroller.version = "1.4.0"; | ||
Scroller.version = "1.4.1"; | ||
@@ -1302,4 +1340,12 @@ | ||
Api.register( 'scroller.page()', function() { | ||
var ctx = this.context; | ||
if ( ctx.length && ctx[0].oScroller ) { | ||
return ctx[0].oScroller.fnPageInfo(); | ||
} | ||
// undefined | ||
} ); | ||
return Scroller; | ||
})); |
{ | ||
"name": "datatables.net-scroller", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "Scroller for DataTables ", | ||
@@ -5,0 +5,0 @@ "files": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
43441
1173