mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-08 10:38:15 +01:00
Last version of JQuery 1.12 and DataTables Componenent with working
export Excel,CVS,PDF, etc..
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
/*! Scroller 1.2.2
|
||||
* ©2011-2014 SpryMedia Ltd - datatables.net/license
|
||||
/*! Scroller 1.4.1
|
||||
* ©2011-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
|
||||
/**
|
||||
* @summary Scroller
|
||||
* @description Virtual rendering for DataTables
|
||||
* @version 1.2.2
|
||||
* @version 1.4.1
|
||||
* @file dataTables.scroller.js
|
||||
* @author SpryMedia Ltd (www.sprymedia.co.uk)
|
||||
* @contact www.sprymedia.co.uk/contact
|
||||
* @copyright Copyright 2011-2014 SpryMedia Ltd.
|
||||
* @copyright Copyright 2011-2016 SpryMedia Ltd.
|
||||
*
|
||||
* This source file is free software, available under the following license:
|
||||
* MIT license - http://datatables.net/license/mit
|
||||
@@ -21,11 +21,35 @@
|
||||
* For details please refer to: http://www.datatables.net
|
||||
*/
|
||||
|
||||
(function(window, document, undefined){
|
||||
(function( factory ){
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
// AMD
|
||||
define( ['jquery', 'datatables.net'], function ( $ ) {
|
||||
return factory( $, window, document );
|
||||
} );
|
||||
}
|
||||
else if ( typeof exports === 'object' ) {
|
||||
// CommonJS
|
||||
module.exports = function (root, $) {
|
||||
if ( ! root ) {
|
||||
root = window;
|
||||
}
|
||||
|
||||
if ( ! $ || ! $.fn.dataTable ) {
|
||||
$ = require('datatables.net')(root, $).$;
|
||||
}
|
||||
|
||||
return factory( $, root, root.document );
|
||||
};
|
||||
}
|
||||
else {
|
||||
// Browser
|
||||
factory( jQuery, window, document );
|
||||
}
|
||||
}(function( $, window, document, undefined ) {
|
||||
'use strict';
|
||||
var DataTable = $.fn.dataTable;
|
||||
|
||||
var factory = function( $, DataTable ) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* Scroller is a virtual rendering plug-in for DataTables which allows large
|
||||
@@ -48,7 +72,7 @@ var factory = function( $, DataTable ) {
|
||||
* Key features include:
|
||||
* <ul class="limit_length">
|
||||
* <li>Speed! The aim of Scroller for DataTables is to make rendering large data sets fast</li>
|
||||
* <li>Full compatibility with deferred rendering in DataTables 1.9 for maximum speed</li>
|
||||
* <li>Full compatibility with deferred rendering in DataTables for maximum speed</li>
|
||||
* <li>Display millions of rows</li>
|
||||
* <li>Integration with state saving in DataTables (scrolling position is saved)</li>
|
||||
* <li>Easy to use</li>
|
||||
@@ -57,34 +81,32 @@ var factory = function( $, DataTable ) {
|
||||
* @class
|
||||
* @constructor
|
||||
* @global
|
||||
* @param {object} oDT DataTables settings object
|
||||
* @param {object} [oOpts={}] Configuration object for FixedColumns. Options
|
||||
* @param {object} dt DataTables settings object or API instance
|
||||
* @param {object} [opts={}] Configuration object for FixedColumns. Options
|
||||
* are defined by {@link Scroller.defaults}
|
||||
*
|
||||
* @requires jQuery 1.7+
|
||||
* @requires DataTables 1.9.0+
|
||||
* @requires DataTables 1.10.0+
|
||||
*
|
||||
* @example
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "sScrollY": "200px",
|
||||
* "sAjaxSource": "media/dataset/large.txt",
|
||||
* "sDom": "frtiS",
|
||||
* "bDeferRender": true
|
||||
* $('#example').DataTable( {
|
||||
* "scrollY": "200px",
|
||||
* "ajax": "media/dataset/large.txt",
|
||||
* "dom": "frtiS",
|
||||
* "deferRender": true
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
var Scroller = function ( oDTSettings, oOpts ) {
|
||||
var Scroller = function ( dt, opts ) {
|
||||
/* Sanity check - you just know it will happen */
|
||||
if ( ! this instanceof Scroller )
|
||||
{
|
||||
if ( ! (this instanceof Scroller) ) {
|
||||
alert( "Scroller warning: Scroller must be initialised with the 'new' keyword." );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( typeof oOpts == 'undefined' )
|
||||
{
|
||||
oOpts = {};
|
||||
if ( opts === undefined ) {
|
||||
opts = {};
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +121,7 @@ var Scroller = function ( oDTSettings, oOpts ) {
|
||||
* @type object
|
||||
* @default Passed in as first parameter to constructor
|
||||
*/
|
||||
"dt": oDTSettings,
|
||||
"dt": $.fn.dataTable.Api( dt ).settings()[0],
|
||||
|
||||
/**
|
||||
* Pixel location of the top of the drawn table in the viewport
|
||||
@@ -193,7 +215,7 @@ var Scroller = function ( oDTSettings, oOpts ) {
|
||||
|
||||
// @todo The defaults should extend a `c` property and the internal settings
|
||||
// only held in the `s` property. At the moment they are mixed
|
||||
this.s = $.extend( this.s, Scroller.oDefaults, oOpts );
|
||||
this.s = $.extend( this.s, Scroller.oDefaults, opts );
|
||||
|
||||
// Workaround for row height being read from height object (see above comment)
|
||||
this.s.heights.row = this.s.rowHeight;
|
||||
@@ -211,7 +233,12 @@ var Scroller = function ( oDTSettings, oOpts ) {
|
||||
"loader": null
|
||||
};
|
||||
|
||||
/* Attach the instance to the DataTables instance so it can be accessed */
|
||||
// Attach the instance to the DataTables instance so it can be accessed in
|
||||
// future. Don't initialise Scroller twice on the same table
|
||||
if ( this.s.dt.oScroller ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.s.dt.oScroller = this;
|
||||
|
||||
/* Let's do it */
|
||||
@@ -220,7 +247,7 @@ var Scroller = function ( oDTSettings, oOpts ) {
|
||||
|
||||
|
||||
|
||||
Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
$.extend( Scroller.prototype, {
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Public methods
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
@@ -404,17 +431,43 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
|
||||
var heights = this.s.heights;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if ( bRedraw === undefined || bRedraw )
|
||||
{
|
||||
this.s.dt.oInstance.fnDraw();
|
||||
this.s.dt.oInstance.fnDraw( false );
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
};
|
||||
},
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* Private methods (they are of course public in JS, but recommended as private)
|
||||
@@ -438,7 +491,7 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
/* Insert a div element that we can use to force the DT scrolling container to
|
||||
* the height that would be required if the whole table was being displayed
|
||||
*/
|
||||
this.dom.force.style.position = "absolute";
|
||||
this.dom.force.style.position = "relative";
|
||||
this.dom.force.style.top = "0px";
|
||||
this.dom.force.style.left = "0px";
|
||||
this.dom.force.style.width = "1px";
|
||||
@@ -458,7 +511,7 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
// Add a 'loading' indicator
|
||||
if ( this.s.loadingIndicator )
|
||||
{
|
||||
this.dom.loader = $('<div class="DTS_Loading">'+this.s.dt.oLanguage.sLoadingRecords+'</div>')
|
||||
this.dom.loader = $('<div class="dataTables_processing DTS_Loading">'+this.s.dt.oLanguage.sLoadingRecords+'</div>')
|
||||
.css('display', 'none');
|
||||
|
||||
$(this.dom.scroller.parentNode)
|
||||
@@ -529,6 +582,14 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
this.s.topRowFloat = this.s.dt.oLoadedState.iScrollerTopRow || 0;
|
||||
}
|
||||
|
||||
// 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();
|
||||
} );
|
||||
|
||||
/* Destructor */
|
||||
this.s.dt.aoDestroyCallback.push( {
|
||||
"sName": "Scroller",
|
||||
@@ -537,6 +598,7 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
$(that.dom.scroller).off('touchstart.DTS scroll.DTS');
|
||||
$(that.s.dt.nTableWrapper).removeClass('DTS');
|
||||
$('div.DTS_Loading', that.dom.scroller.parentNode).remove();
|
||||
$(that.s.dt.nTable).off( 'init.dt' );
|
||||
|
||||
that.dom.table.style.position = "";
|
||||
that.dom.table.style.top = "";
|
||||
@@ -635,9 +697,6 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
}
|
||||
|
||||
that.s.dt._iDisplayStart = iTopRow;
|
||||
if ( that.s.dt.oApi._fnCalculateEnd ) { // Removed in 1.10
|
||||
that.s.dt.oApi._fnCalculateEnd( that.s.dt );
|
||||
}
|
||||
that.s.dt.oApi._fnDraw( that.s.dt );
|
||||
};
|
||||
|
||||
@@ -682,14 +741,7 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
// If the virtual and physical height match, then we use a linear
|
||||
// transform between the two, allowing the scrollbar to be linear
|
||||
if ( heights.virtual === heights.scroll ) {
|
||||
coeff = (heights.virtual-heights.viewport) / (heights.scroll-heights.viewport);
|
||||
|
||||
if ( dir === 'virtualToPhysical' ) {
|
||||
return val / coeff;
|
||||
}
|
||||
else if ( dir === 'physicalToVirtual' ) {
|
||||
return val * coeff;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
// Otherwise, we want a non-linear scrollbar to take account of the
|
||||
@@ -832,10 +884,12 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
|
||||
// Because of the order of the DT callbacks, the info update will
|
||||
// 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 );
|
||||
}
|
||||
|
||||
// Hide the loading indicator
|
||||
if ( this.dom.loader && this.s.loaderVisible ) {
|
||||
@@ -868,7 +922,11 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
heights.scroll = max;
|
||||
}
|
||||
|
||||
this.dom.force.style.height = heights.scroll+"px";
|
||||
// Minimum height so there is always a row visible (the 'no rows found'
|
||||
// if reduced to zero filtering)
|
||||
this.dom.force.style.height = heights.scroll > this.s.heights.row ?
|
||||
heights.scroll+'px' :
|
||||
this.s.heights.row+'px';
|
||||
},
|
||||
|
||||
|
||||
@@ -903,18 +961,16 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
|
||||
$('div.'+dt.oClasses.sScrollBody, container).append( nTable );
|
||||
|
||||
var appendTo;
|
||||
if (dt._bInitComplete) {
|
||||
appendTo = origTable.parentNode;
|
||||
} else {
|
||||
if (!this.s.dt.nHolding) {
|
||||
this.s.dt.nHolding = $( '<div></div>' ).insertBefore( this.s.dt.nTable );
|
||||
}
|
||||
appendTo = this.s.dt.nHolding;
|
||||
// If initialised using `dom`, use the holding element as the insert point
|
||||
var insertEl = this.s.dt.nHolding || origTable.parentNode;
|
||||
|
||||
if ( ! $(insertEl).is(':visible') ) {
|
||||
insertEl = 'body';
|
||||
}
|
||||
|
||||
container.appendTo( appendTo );
|
||||
container.appendTo( insertEl );
|
||||
this.s.heights.row = $('tr', tbody).eq(1).outerHeight();
|
||||
|
||||
container.remove();
|
||||
},
|
||||
|
||||
@@ -1002,7 +1058,7 @@ Scroller.prototype = /** @lends Scroller.prototype */{
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
} );
|
||||
|
||||
|
||||
|
||||
@@ -1155,7 +1211,7 @@ Scroller.oDefaults = Scroller.defaults;
|
||||
* @name Scroller.version
|
||||
* @static
|
||||
*/
|
||||
Scroller.version = "1.2.2";
|
||||
Scroller.version = "1.4.1";
|
||||
|
||||
|
||||
|
||||
@@ -1163,19 +1219,17 @@ Scroller.version = "1.2.2";
|
||||
* Initialisation
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
/*
|
||||
* Register a new feature with DataTables
|
||||
*/
|
||||
// Legacy `dom` parameter initialisation support
|
||||
if ( typeof $.fn.dataTable == "function" &&
|
||||
typeof $.fn.dataTableExt.fnVersionCheck == "function" &&
|
||||
$.fn.dataTableExt.fnVersionCheck('1.9.0') )
|
||||
$.fn.dataTableExt.fnVersionCheck('1.10.0') )
|
||||
{
|
||||
$.fn.dataTableExt.aoFeatures.push( {
|
||||
"fnInit": function( oDTSettings ) {
|
||||
var init = oDTSettings.oInit;
|
||||
var opts = init.scroller || init.oScroller || {};
|
||||
var oScroller = new Scroller( oDTSettings, opts );
|
||||
return oScroller.dom.wrapper;
|
||||
|
||||
new Scroller( oDTSettings, opts );
|
||||
},
|
||||
"cFeature": "S",
|
||||
"sFeature": "Scroller"
|
||||
@@ -1183,9 +1237,28 @@ if ( typeof $.fn.dataTable == "function" &&
|
||||
}
|
||||
else
|
||||
{
|
||||
alert( "Warning: Scroller requires DataTables 1.9.0 or greater - www.datatables.net/download");
|
||||
alert( "Warning: Scroller requires DataTables 1.10.0 or greater - www.datatables.net/download");
|
||||
}
|
||||
|
||||
// Attach a listener to the document which listens for DataTables initialisation
|
||||
// events so we can automatically initialise
|
||||
$(document).on( 'preInit.dt.dtscroller', function (e, settings) {
|
||||
if ( e.namespace !== 'dt' ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var init = settings.oInit.scroller;
|
||||
var defaults = DataTable.defaults.scroller;
|
||||
|
||||
if ( init || defaults ) {
|
||||
var opts = $.extend( {}, init, defaults );
|
||||
|
||||
if ( init !== false ) {
|
||||
new Scroller( settings, opts );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
|
||||
// Attach Scroller to DataTables so it can be accessed as an 'extra'
|
||||
$.fn.dataTable.Scroller = Scroller;
|
||||
@@ -1193,70 +1266,78 @@ $.fn.DataTable.Scroller = Scroller;
|
||||
|
||||
|
||||
// DataTables 1.10 API method aliases
|
||||
if ( $.fn.dataTable.Api ) {
|
||||
var Api = $.fn.dataTable.Api;
|
||||
var Api = $.fn.dataTable.Api;
|
||||
|
||||
Api.register( 'scroller()', function () {
|
||||
return this;
|
||||
} );
|
||||
Api.register( 'scroller()', function () {
|
||||
return this;
|
||||
} );
|
||||
|
||||
Api.register( 'scroller().rowToPixels()', function ( rowIdx, intParse, virtual ) {
|
||||
var ctx = this.context;
|
||||
// Undocumented and deprecated - is it actually useful at all?
|
||||
Api.register( 'scroller().rowToPixels()', function ( rowIdx, intParse, virtual ) {
|
||||
var ctx = this.context;
|
||||
|
||||
if ( ctx.length && ctx[0].oScroller ) {
|
||||
return ctx[0].oScroller.fnRowToPixels( rowIdx, intParse, virtual );
|
||||
if ( ctx.length && ctx[0].oScroller ) {
|
||||
return ctx[0].oScroller.fnRowToPixels( rowIdx, intParse, virtual );
|
||||
}
|
||||
// undefined
|
||||
} );
|
||||
|
||||
// Undocumented and deprecated - is it actually useful at all?
|
||||
Api.register( 'scroller().pixelsToRow()', function ( pixels, intParse, virtual ) {
|
||||
var ctx = this.context;
|
||||
|
||||
if ( ctx.length && ctx[0].oScroller ) {
|
||||
return ctx[0].oScroller.fnPixelsToRow( pixels, intParse, virtual );
|
||||
}
|
||||
// undefined
|
||||
} );
|
||||
|
||||
// Undocumented and deprecated - use `row().scrollTo()` instead
|
||||
Api.register( 'scroller().scrollToRow()', function ( row, ani ) {
|
||||
this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx.oScroller ) {
|
||||
ctx.oScroller.fnScrollToRow( row, ani );
|
||||
}
|
||||
// undefined
|
||||
} );
|
||||
|
||||
Api.register( 'scroller().pixelsToRow()', function ( pixels, intParse, virtual ) {
|
||||
var ctx = this.context;
|
||||
return this;
|
||||
} );
|
||||
|
||||
if ( ctx.length && ctx[0].oScroller ) {
|
||||
return ctx[0].oScroller.fnPixelsToRow( pixels, intParse, virtual );
|
||||
Api.register( 'row().scrollTo()', function ( ani ) {
|
||||
var that = this;
|
||||
|
||||
this.iterator( 'row', function ( ctx, rowIdx ) {
|
||||
if ( ctx.oScroller ) {
|
||||
var displayIdx = that
|
||||
.rows( { order: 'applied', search: 'applied' } )
|
||||
.indexes()
|
||||
.indexOf( rowIdx );
|
||||
|
||||
ctx.oScroller.fnScrollToRow( displayIdx, ani );
|
||||
}
|
||||
// undefined
|
||||
} );
|
||||
|
||||
Api.register( 'scroller().scrollToRow()', function ( row, ani ) {
|
||||
this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx.oScroller ) {
|
||||
ctx.oScroller.fnScrollToRow( row, ani );
|
||||
}
|
||||
} );
|
||||
return this;
|
||||
} );
|
||||
|
||||
return this;
|
||||
Api.register( 'scroller.measure()', function ( redraw ) {
|
||||
this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx.oScroller ) {
|
||||
ctx.oScroller.fnMeasure( redraw );
|
||||
}
|
||||
} );
|
||||
|
||||
Api.register( 'scroller().measure()', function ( redraw ) {
|
||||
this.iterator( 'table', function ( ctx ) {
|
||||
if ( ctx.oScroller ) {
|
||||
ctx.oScroller.fnMeasure( redraw );
|
||||
}
|
||||
} );
|
||||
return this;
|
||||
} );
|
||||
|
||||
return this;
|
||||
} );
|
||||
}
|
||||
Api.register( 'scroller.page()', function() {
|
||||
var ctx = this.context;
|
||||
|
||||
if ( ctx.length && ctx[0].oScroller ) {
|
||||
return ctx[0].oScroller.fnPageInfo();
|
||||
}
|
||||
// undefined
|
||||
} );
|
||||
|
||||
return Scroller;
|
||||
}; // /factory
|
||||
|
||||
|
||||
// Define as an AMD module if possible
|
||||
if ( typeof define === 'function' && define.amd ) {
|
||||
define( ['jquery', 'datatables'], factory );
|
||||
}
|
||||
else if ( typeof exports === 'object' ) {
|
||||
// Node/CommonJS
|
||||
factory( require('jquery'), require('datatables') );
|
||||
}
|
||||
else if ( jQuery && !jQuery.fn.dataTable.Scroller ) {
|
||||
// Otherwise simply initialise as normal, stopping multiple evaluation
|
||||
factory( jQuery, jQuery.fn.dataTable );
|
||||
}
|
||||
|
||||
|
||||
})(window, document);
|
||||
|
||||
}));
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
/*!
|
||||
Scroller 1.2.2
|
||||
©2011-2014 SpryMedia Ltd - datatables.net/license
|
||||
Scroller 1.4.1
|
||||
©2011-2016 SpryMedia Ltd - datatables.net/license
|
||||
*/
|
||||
(function(m,n,k){var l=function(e){var g=function(a,b){!this instanceof g?alert("Scroller warning: Scroller must be initialised with the 'new' keyword."):("undefined"==typeof b&&(b={}),this.s={dt:a,tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,autoHeight:!0,viewportRows:0,stateTO:null,drawTO:null,heights:{jump:null,page:null,virtual:null,scroll:null,row:null,viewport:null},topRowFloat:0,scrollDrawDiff:null,loaderVisible:!1},this.s=e.extend(this.s,g.oDefaults,b),this.s.heights.row=this.s.rowHeight,
|
||||
this.dom={force:n.createElement("div"),scroller:null,table:null,loader:null},this.s.dt.oScroller=this,this._fnConstruct())};g.prototype={fnRowToPixels:function(a,b,c){a=c?this._domain("virtualToPhysical",a*this.s.heights.row):this.s.baseScrollTop+(a-this.s.baseRowTop)*this.s.heights.row;return b||b===k?parseInt(a,10):a},fnPixelsToRow:function(a,b,c){var d=a-this.s.baseScrollTop,a=c?this._domain("physicalToVirtual",a)/this.s.heights.row:d/this.s.heights.row+this.s.baseRowTop;return b||b===k?parseInt(a,
|
||||
10):a},fnScrollToRow:function(a,b){var c=this,d=!1,f=this.fnRowToPixels(a),h=a-(this.s.displayBuffer-1)/2*this.s.viewportRows;0>h&&(h=0);if((f>this.s.redrawBottom||f<this.s.redrawTop)&&this.s.dt._iDisplayStart!==h)d=!0,f=this.fnRowToPixels(a,!1,!0);"undefined"==typeof b||b?(this.s.ani=d,e(this.dom.scroller).animate({scrollTop:f},function(){setTimeout(function(){c.s.ani=!1},25)})):e(this.dom.scroller).scrollTop(f)},fnMeasure:function(a){this.s.autoHeight&&this._fnCalcRowHeight();var b=this.s.heights;
|
||||
b.viewport=e(this.dom.scroller).height();this.s.viewportRows=parseInt(b.viewport/b.row,10)+1;this.s.dt._iDisplayLength=this.s.viewportRows*this.s.displayBuffer;(a===k||a)&&this.s.dt.oInstance.fnDraw()},_fnConstruct:function(){var a=this;if(this.s.dt.oFeatures.bPaginate){this.dom.force.style.position="absolute";this.dom.force.style.top="0px";this.dom.force.style.left="0px";this.dom.force.style.width="1px";this.dom.scroller=e("div."+this.s.dt.oClasses.sScrollBody,this.s.dt.nTableWrapper)[0];this.dom.scroller.appendChild(this.dom.force);
|
||||
this.dom.scroller.style.position="relative";this.dom.table=e(">table",this.dom.scroller)[0];this.dom.table.style.position="absolute";this.dom.table.style.top="0px";this.dom.table.style.left="0px";e(this.s.dt.nTableWrapper).addClass("DTS");this.s.loadingIndicator&&(this.dom.loader=e('<div class="DTS_Loading">'+this.s.dt.oLanguage.sLoadingRecords+"</div>").css("display","none"),e(this.dom.scroller.parentNode).css("position","relative").append(this.dom.loader));this.s.heights.row&&"auto"!=this.s.heights.row&&
|
||||
(this.s.autoHeight=!1);this.fnMeasure(!1);this.s.ingnoreScroll=!0;this.s.stateSaveThrottle=this.s.dt.oApi._fnThrottle(function(){a.s.dt.oApi._fnSaveState(a.s.dt)},500);e(this.dom.scroller).on("scroll.DTS",function(){a._fnScroll.call(a)});e(this.dom.scroller).on("touchstart.DTS",function(){a._fnScroll.call(a)});this.s.dt.aoDrawCallback.push({fn:function(){a.s.dt.bInitialised&&a._fnDrawCallback.call(a)},sName:"Scroller"});e(m).on("resize.DTS",function(){a.fnMeasure(false);a._fnInfo()});var b=!0;this.s.dt.oApi._fnCallbackReg(this.s.dt,
|
||||
"aoStateSaveParams",function(c,d){if(b&&a.s.dt.oLoadedState){d.iScroller=a.s.dt.oLoadedState.iScroller;d.iScrollerTopRow=a.s.dt.oLoadedState.iScrollerTopRow;b=false}else{d.iScroller=a.dom.scroller.scrollTop;d.iScrollerTopRow=a.s.topRowFloat}},"Scroller_State");this.s.dt.oLoadedState&&(this.s.topRowFloat=this.s.dt.oLoadedState.iScrollerTopRow||0);this.s.dt.aoDestroyCallback.push({sName:"Scroller",fn:function(){e(m).off("resize.DTS");e(a.dom.scroller).off("touchstart.DTS scroll.DTS");e(a.s.dt.nTableWrapper).removeClass("DTS");
|
||||
e("div.DTS_Loading",a.dom.scroller.parentNode).remove();a.dom.table.style.position="";a.dom.table.style.top="";a.dom.table.style.left=""}})}else this.s.dt.oApi._fnLog(this.s.dt,0,"Pagination must be enabled for Scroller")},_fnScroll:function(){var a=this,b=this.s.heights,c=this.dom.scroller.scrollTop,d;if(!this.s.skip&&!this.s.ingnoreScroll)if(this.s.dt.bFiltered||this.s.dt.bSorted)this.s.lastScrollTop=0;else{this._fnInfo();clearTimeout(this.s.stateTO);this.s.stateTO=setTimeout(function(){a.s.dt.oApi._fnSaveState(a.s.dt)},
|
||||
250);if(c<this.s.redrawTop||c>this.s.redrawBottom){var f=Math.ceil((this.s.displayBuffer-1)/2*this.s.viewportRows);Math.abs(c-this.s.lastScrollTop)>b.viewport||this.s.ani?(d=parseInt(this._domain("physicalToVirtual",c)/b.row,10)-f,this.s.topRowFloat=this._domain("physicalToVirtual",c)/b.row):(d=this.fnPixelsToRow(c)-f,this.s.topRowFloat=this.fnPixelsToRow(c,!1));0>=d?d=0:d+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()?(d=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength,0>d&&(d=0)):
|
||||
0!==d%2&&d++;if(d!=this.s.dt._iDisplayStart&&(this.s.tableTop=e(this.s.dt.nTable).offset().top,this.s.tableBottom=e(this.s.dt.nTable).height()+this.s.tableTop,b=function(){if(a.s.scrollDrawReq===null)a.s.scrollDrawReq=c;a.s.dt._iDisplayStart=d;a.s.dt.oApi._fnCalculateEnd&&a.s.dt.oApi._fnCalculateEnd(a.s.dt);a.s.dt.oApi._fnDraw(a.s.dt)},this.s.dt.oFeatures.bServerSide?(clearTimeout(this.s.drawTO),this.s.drawTO=setTimeout(b,this.s.serverWait)):b(),this.dom.loader&&!this.s.loaderVisible))this.dom.loader.css("display",
|
||||
"block"),this.s.loaderVisible=!0}this.s.lastScrollTop=c;this.s.stateSaveThrottle()}},_domain:function(a,b){var c=this.s.heights,d;if(c.virtual===c.scroll){d=(c.virtual-c.viewport)/(c.scroll-c.viewport);if("virtualToPhysical"===a)return b/d;if("physicalToVirtual"===a)return b*d}var e=(c.scroll-c.viewport)/2,h=(c.virtual-c.viewport)/2;d=h/(e*e);if("virtualToPhysical"===a){if(b<h)return Math.pow(b/d,0.5);b=2*h-b;return 0>b?c.scroll:2*e-Math.pow(b/d,0.5)}if("physicalToVirtual"===a){if(b<e)return b*b*
|
||||
d;b=2*e-b;return 0>b?c.virtual:2*h-b*b*d}},_fnDrawCallback:function(){var a=this,b=this.s.heights,c=this.dom.scroller.scrollTop,d=e(this.s.dt.nTable).height(),f=this.s.dt._iDisplayStart,h=this.s.dt._iDisplayLength,g=this.s.dt.fnRecordsDisplay();this.s.skip=!0;this._fnScrollForce();c=0===f?this.s.topRowFloat*b.row:f+h>=g?b.scroll-(g-this.s.topRowFloat)*b.row:this._domain("virtualToPhysical",this.s.topRowFloat*b.row);this.dom.scroller.scrollTop=c;this.s.baseScrollTop=c;this.s.baseRowTop=this.s.topRowFloat;
|
||||
var j=c-(this.s.topRowFloat-f)*b.row;0===f?j=0:f+h>=g&&(j=b.scroll-d);this.dom.table.style.top=j+"px";this.s.tableTop=j;this.s.tableBottom=d+this.s.tableTop;d=(c-this.s.tableTop)*this.s.boundaryScale;this.s.redrawTop=c-d;this.s.redrawBottom=c+d;this.s.skip=!1;this.s.dt.oFeatures.bStateSave&&null!==this.s.dt.oLoadedState&&"undefined"!=typeof this.s.dt.oLoadedState.iScroller?((c=(this.s.dt.sAjaxSource||a.s.dt.ajax)&&!this.s.dt.oFeatures.bServerSide?!0:!1)&&2==this.s.dt.iDraw||!c&&1==this.s.dt.iDraw)&&
|
||||
setTimeout(function(){e(a.dom.scroller).scrollTop(a.s.dt.oLoadedState.iScroller);a.s.redrawTop=a.s.dt.oLoadedState.iScroller-b.viewport/2;setTimeout(function(){a.s.ingnoreScroll=!1},0)},0):a.s.ingnoreScroll=!1;setTimeout(function(){a._fnInfo.call(a)},0);this.dom.loader&&this.s.loaderVisible&&(this.dom.loader.css("display","none"),this.s.loaderVisible=!1)},_fnScrollForce:function(){var a=this.s.heights;a.virtual=a.row*this.s.dt.fnRecordsDisplay();a.scroll=a.virtual;1E6<a.scroll&&(a.scroll=1E6);this.dom.force.style.height=
|
||||
a.scroll+"px"},_fnCalcRowHeight:function(){var a=this.s.dt,b=a.nTable,c=b.cloneNode(!1),d=e("<tbody/>").appendTo(c),f=e('<div class="'+a.oClasses.sWrapper+' DTS"><div class="'+a.oClasses.sScrollWrapper+'"><div class="'+a.oClasses.sScrollBody+'"></div></div></div>');for(e("tbody tr:lt(4)",b).clone().appendTo(d);3>e("tr",d).length;)d.append("<tr><td> </td></tr>");e("div."+a.oClasses.sScrollBody,f).append(c);a._bInitComplete?a=b.parentNode:(this.s.dt.nHolding||(this.s.dt.nHolding=e("<div></div>").insertBefore(this.s.dt.nTable)),
|
||||
a=this.s.dt.nHolding);f.appendTo(a);this.s.heights.row=e("tr",d).eq(1).outerHeight();f.remove()},_fnInfo:function(){if(this.s.dt.oFeatures.bInfo){var a=this.s.dt,b=a.oLanguage,c=this.dom.scroller.scrollTop,d=Math.floor(this.fnPixelsToRow(c,!1,this.s.ani)+1),f=a.fnRecordsTotal(),h=a.fnRecordsDisplay(),c=Math.ceil(this.fnPixelsToRow(c+this.s.heights.viewport,!1,this.s.ani)),c=h<c?h:c,g=a.fnFormatNumber(d),j=a.fnFormatNumber(c),i=a.fnFormatNumber(f),k=a.fnFormatNumber(h),g=0===a.fnRecordsDisplay()&&
|
||||
a.fnRecordsDisplay()==a.fnRecordsTotal()?b.sInfoEmpty+b.sInfoPostFix:0===a.fnRecordsDisplay()?b.sInfoEmpty+" "+b.sInfoFiltered.replace("_MAX_",i)+b.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?b.sInfo.replace("_START_",g).replace("_END_",j).replace("_MAX_",i).replace("_TOTAL_",k)+b.sInfoPostFix:b.sInfo.replace("_START_",g).replace("_END_",j).replace("_MAX_",i).replace("_TOTAL_",k)+" "+b.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+b.sInfoPostFix;(b=b.fnInfoCallback)&&
|
||||
(g=b.call(a.oInstance,a,d,c,f,h,g));a=a.aanFeatures.i;if("undefined"!=typeof a){d=0;for(f=a.length;d<f;d++)e(a[d]).html(g)}}}};g.defaults={trace:!1,rowHeight:"auto",serverWait:200,displayBuffer:9,boundaryScale:0.5,loadingIndicator:!1};g.oDefaults=g.defaults;g.version="1.2.2";"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.9.0")?e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInit;return(new g(a,b.scroller||
|
||||
b.oScroller||{})).dom.wrapper},cFeature:"S",sFeature:"Scroller"}):alert("Warning: Scroller requires DataTables 1.9.0 or greater - www.datatables.net/download");e.fn.dataTable.Scroller=g;e.fn.DataTable.Scroller=g;if(e.fn.dataTable.Api){var i=e.fn.dataTable.Api;i.register("scroller()",function(){return this});i.register("scroller().rowToPixels()",function(a,b,c){var d=this.context;if(d.length&&d[0].oScroller)return d[0].oScroller.fnRowToPixels(a,b,c)});i.register("scroller().pixelsToRow()",function(a,
|
||||
b,c){var d=this.context;if(d.length&&d[0].oScroller)return d[0].oScroller.fnPixelsToRow(a,b,c)});i.register("scroller().scrollToRow()",function(a,b){this.iterator("table",function(c){c.oScroller&&c.oScroller.fnScrollToRow(a,b)});return this});i.register("scroller().measure()",function(a){this.iterator("table",function(b){b.oScroller&&b.oScroller.fnMeasure(a)});return this})}return g};"function"===typeof define&&define.amd?define(["jquery","datatables"],l):"object"===typeof exports?l(require("jquery"),
|
||||
require("datatables")):jQuery&&!jQuery.fn.dataTable.Scroller&&l(jQuery,jQuery.fn.dataTable)})(window,document);
|
||||
(function(e){"function"===typeof define&&define.amd?define(["jquery","datatables.net"],function(g){return e(g,window,document)}):"object"===typeof exports?module.exports=function(g,i){g||(g=window);if(!i||!i.fn.dataTable)i=require("datatables.net")(g,i).$;return e(i,g,g.document)}:e(jQuery,window,document)})(function(e,g,i,l){var m=e.fn.dataTable,h=function(a,b){this instanceof h?(b===l&&(b={}),this.s={dt:e.fn.dataTable.Api(a).settings()[0],tableTop:0,tableBottom:0,redrawTop:0,redrawBottom:0,autoHeight:!0,
|
||||
viewportRows:0,stateTO:null,drawTO:null,heights:{jump:null,page:null,virtual:null,scroll:null,row:null,viewport:null},topRowFloat:0,scrollDrawDiff:null,loaderVisible:!1},this.s=e.extend(this.s,h.oDefaults,b),this.s.heights.row=this.s.rowHeight,this.dom={force:i.createElement("div"),scroller:null,table:null,loader:null},this.s.dt.oScroller||(this.s.dt.oScroller=this,this._fnConstruct())):alert("Scroller warning: Scroller must be initialised with the 'new' keyword.")};e.extend(h.prototype,{fnRowToPixels:function(a,
|
||||
b,c){a=c?this._domain("virtualToPhysical",a*this.s.heights.row):this.s.baseScrollTop+(a-this.s.baseRowTop)*this.s.heights.row;return b||b===l?parseInt(a,10):a},fnPixelsToRow:function(a,b,c){var d=a-this.s.baseScrollTop,a=c?this._domain("physicalToVirtual",a)/this.s.heights.row:d/this.s.heights.row+this.s.baseRowTop;return b||b===l?parseInt(a,10):a},fnScrollToRow:function(a,b){var c=this,d=!1,f=this.fnRowToPixels(a),j=a-(this.s.displayBuffer-1)/2*this.s.viewportRows;0>j&&(j=0);if((f>this.s.redrawBottom||
|
||||
f<this.s.redrawTop)&&this.s.dt._iDisplayStart!==j)d=!0,f=this.fnRowToPixels(a,!1,!0);"undefined"==typeof b||b?(this.s.ani=d,e(this.dom.scroller).animate({scrollTop:f},function(){setTimeout(function(){c.s.ani=!1},25)})):e(this.dom.scroller).scrollTop(f)},fnMeasure:function(a){this.s.autoHeight&&this._fnCalcRowHeight();var b=this.s.heights;b.row&&(b.viewport=e(this.dom.scroller).height(),this.s.viewportRows=parseInt(b.viewport/b.row,10)+1,this.s.dt._iDisplayLength=this.s.viewportRows*this.s.displayBuffer);
|
||||
(a===l||a)&&this.s.dt.oInstance.fnDraw(!1)},fnPageInfo:function(){var a=this.dom.scroller.scrollTop,b=this.s.dt.fnRecordsDisplay(),c=Math.ceil(this.fnPixelsToRow(a+this.s.heights.viewport,!1,this.s.ani));return{start:Math.floor(this.fnPixelsToRow(a,!1,this.s.ani)),end:b<c?b-1:c-1}},_fnConstruct:function(){var a=this;if(this.s.dt.oFeatures.bPaginate){this.dom.force.style.position="relative";this.dom.force.style.top="0px";this.dom.force.style.left="0px";this.dom.force.style.width="1px";this.dom.scroller=
|
||||
e("div."+this.s.dt.oClasses.sScrollBody,this.s.dt.nTableWrapper)[0];this.dom.scroller.appendChild(this.dom.force);this.dom.scroller.style.position="relative";this.dom.table=e(">table",this.dom.scroller)[0];this.dom.table.style.position="absolute";this.dom.table.style.top="0px";this.dom.table.style.left="0px";e(this.s.dt.nTableWrapper).addClass("DTS");this.s.loadingIndicator&&(this.dom.loader=e('<div class="dataTables_processing DTS_Loading">'+this.s.dt.oLanguage.sLoadingRecords+"</div>").css("display",
|
||||
"none"),e(this.dom.scroller.parentNode).css("position","relative").append(this.dom.loader));this.s.heights.row&&"auto"!=this.s.heights.row&&(this.s.autoHeight=!1);this.fnMeasure(!1);this.s.ingnoreScroll=!0;this.s.stateSaveThrottle=this.s.dt.oApi._fnThrottle(function(){a.s.dt.oApi._fnSaveState(a.s.dt)},500);e(this.dom.scroller).on("scroll.DTS",function(){a._fnScroll.call(a)});e(this.dom.scroller).on("touchstart.DTS",function(){a._fnScroll.call(a)});this.s.dt.aoDrawCallback.push({fn:function(){a.s.dt.bInitialised&&
|
||||
a._fnDrawCallback.call(a)},sName:"Scroller"});e(g).on("resize.DTS",function(){a.fnMeasure(false);a._fnInfo()});var b=!0;this.s.dt.oApi._fnCallbackReg(this.s.dt,"aoStateSaveParams",function(c,d){if(b&&a.s.dt.oLoadedState){d.iScroller=a.s.dt.oLoadedState.iScroller;d.iScrollerTopRow=a.s.dt.oLoadedState.iScrollerTopRow;b=false}else{d.iScroller=a.dom.scroller.scrollTop;d.iScrollerTopRow=a.s.topRowFloat}},"Scroller_State");this.s.dt.oLoadedState&&(this.s.topRowFloat=this.s.dt.oLoadedState.iScrollerTopRow||
|
||||
0);e(this.s.dt.nTable).one("init.dt",function(){a.fnMeasure()});this.s.dt.aoDestroyCallback.push({sName:"Scroller",fn:function(){e(g).off("resize.DTS");e(a.dom.scroller).off("touchstart.DTS scroll.DTS");e(a.s.dt.nTableWrapper).removeClass("DTS");e("div.DTS_Loading",a.dom.scroller.parentNode).remove();e(a.s.dt.nTable).off("init.dt");a.dom.table.style.position="";a.dom.table.style.top="";a.dom.table.style.left=""}})}else this.s.dt.oApi._fnLog(this.s.dt,0,"Pagination must be enabled for Scroller")},
|
||||
_fnScroll:function(){var a=this,b=this.s.heights,c=this.dom.scroller.scrollTop,d;if(!this.s.skip&&!this.s.ingnoreScroll)if(this.s.dt.bFiltered||this.s.dt.bSorted)this.s.lastScrollTop=0;else{this._fnInfo();clearTimeout(this.s.stateTO);this.s.stateTO=setTimeout(function(){a.s.dt.oApi._fnSaveState(a.s.dt)},250);if(c<this.s.redrawTop||c>this.s.redrawBottom){var f=Math.ceil((this.s.displayBuffer-1)/2*this.s.viewportRows);Math.abs(c-this.s.lastScrollTop)>b.viewport||this.s.ani?(d=parseInt(this._domain("physicalToVirtual",
|
||||
c)/b.row,10)-f,this.s.topRowFloat=this._domain("physicalToVirtual",c)/b.row):(d=this.fnPixelsToRow(c)-f,this.s.topRowFloat=this.fnPixelsToRow(c,!1));0>=d?d=0:d+this.s.dt._iDisplayLength>this.s.dt.fnRecordsDisplay()?(d=this.s.dt.fnRecordsDisplay()-this.s.dt._iDisplayLength,0>d&&(d=0)):0!==d%2&&d++;if(d!=this.s.dt._iDisplayStart&&(this.s.tableTop=e(this.s.dt.nTable).offset().top,this.s.tableBottom=e(this.s.dt.nTable).height()+this.s.tableTop,b=function(){if(a.s.scrollDrawReq===null)a.s.scrollDrawReq=
|
||||
c;a.s.dt._iDisplayStart=d;a.s.dt.oApi._fnDraw(a.s.dt)},this.s.dt.oFeatures.bServerSide?(clearTimeout(this.s.drawTO),this.s.drawTO=setTimeout(b,this.s.serverWait)):b(),this.dom.loader&&!this.s.loaderVisible))this.dom.loader.css("display","block"),this.s.loaderVisible=!0}this.s.lastScrollTop=c;this.s.stateSaveThrottle()}},_domain:function(a,b){var c=this.s.heights,d;if(c.virtual===c.scroll)return b;var e=(c.scroll-c.viewport)/2,j=(c.virtual-c.viewport)/2;d=j/(e*e);if("virtualToPhysical"===a){if(b<j)return Math.pow(b/
|
||||
d,0.5);b=2*j-b;return 0>b?c.scroll:2*e-Math.pow(b/d,0.5)}if("physicalToVirtual"===a){if(b<e)return b*b*d;b=2*e-b;return 0>b?c.virtual:2*j-b*b*d}},_fnDrawCallback:function(){var a=this,b=this.s.heights,c=this.dom.scroller.scrollTop,d=e(this.s.dt.nTable).height(),f=this.s.dt._iDisplayStart,j=this.s.dt._iDisplayLength,h=this.s.dt.fnRecordsDisplay();this.s.skip=!0;this._fnScrollForce();c=0===f?this.s.topRowFloat*b.row:f+j>=h?b.scroll-(h-this.s.topRowFloat)*b.row:this._domain("virtualToPhysical",this.s.topRowFloat*
|
||||
b.row);this.dom.scroller.scrollTop=c;this.s.baseScrollTop=c;this.s.baseRowTop=this.s.topRowFloat;var g=c-(this.s.topRowFloat-f)*b.row;0===f?g=0:f+j>=h&&(g=b.scroll-d);this.dom.table.style.top=g+"px";this.s.tableTop=g;this.s.tableBottom=d+this.s.tableTop;d=(c-this.s.tableTop)*this.s.boundaryScale;this.s.redrawTop=c-d;this.s.redrawBottom=c+d;this.s.skip=!1;this.s.dt.oFeatures.bStateSave&&null!==this.s.dt.oLoadedState&&"undefined"!=typeof this.s.dt.oLoadedState.iScroller?((c=(this.s.dt.sAjaxSource||
|
||||
a.s.dt.ajax)&&!this.s.dt.oFeatures.bServerSide?!0:!1)&&2==this.s.dt.iDraw||!c&&1==this.s.dt.iDraw)&&setTimeout(function(){e(a.dom.scroller).scrollTop(a.s.dt.oLoadedState.iScroller);a.s.redrawTop=a.s.dt.oLoadedState.iScroller-b.viewport/2;setTimeout(function(){a.s.ingnoreScroll=!1},0)},0):a.s.ingnoreScroll=!1;this.s.dt.oFeatures.bInfo&&setTimeout(function(){a._fnInfo.call(a)},0);this.dom.loader&&this.s.loaderVisible&&(this.dom.loader.css("display","none"),this.s.loaderVisible=!1)},_fnScrollForce:function(){var a=
|
||||
this.s.heights;a.virtual=a.row*this.s.dt.fnRecordsDisplay();a.scroll=a.virtual;1E6<a.scroll&&(a.scroll=1E6);this.dom.force.style.height=a.scroll>this.s.heights.row?a.scroll+"px":this.s.heights.row+"px"},_fnCalcRowHeight:function(){var a=this.s.dt,b=a.nTable,c=b.cloneNode(!1),d=e("<tbody/>").appendTo(c),f=e('<div class="'+a.oClasses.sWrapper+' DTS"><div class="'+a.oClasses.sScrollWrapper+'"><div class="'+a.oClasses.sScrollBody+'"></div></div></div>');for(e("tbody tr:lt(4)",b).clone().appendTo(d);3>
|
||||
e("tr",d).length;)d.append("<tr><td> </td></tr>");e("div."+a.oClasses.sScrollBody,f).append(c);a=this.s.dt.nHolding||b.parentNode;e(a).is(":visible")||(a="body");f.appendTo(a);this.s.heights.row=e("tr",d).eq(1).outerHeight();f.remove()},_fnInfo:function(){if(this.s.dt.oFeatures.bInfo){var a=this.s.dt,b=a.oLanguage,c=this.dom.scroller.scrollTop,d=Math.floor(this.fnPixelsToRow(c,!1,this.s.ani)+1),f=a.fnRecordsTotal(),h=a.fnRecordsDisplay(),c=Math.ceil(this.fnPixelsToRow(c+this.s.heights.viewport,
|
||||
!1,this.s.ani)),c=h<c?h:c,g=a.fnFormatNumber(d),i=a.fnFormatNumber(c),k=a.fnFormatNumber(f),l=a.fnFormatNumber(h),g=0===a.fnRecordsDisplay()&&a.fnRecordsDisplay()==a.fnRecordsTotal()?b.sInfoEmpty+b.sInfoPostFix:0===a.fnRecordsDisplay()?b.sInfoEmpty+" "+b.sInfoFiltered.replace("_MAX_",k)+b.sInfoPostFix:a.fnRecordsDisplay()==a.fnRecordsTotal()?b.sInfo.replace("_START_",g).replace("_END_",i).replace("_MAX_",k).replace("_TOTAL_",l)+b.sInfoPostFix:b.sInfo.replace("_START_",g).replace("_END_",i).replace("_MAX_",
|
||||
k).replace("_TOTAL_",l)+" "+b.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+b.sInfoPostFix;(b=b.fnInfoCallback)&&(g=b.call(a.oInstance,a,d,c,f,h,g));a=a.aanFeatures.i;if("undefined"!=typeof a){d=0;for(f=a.length;d<f;d++)e(a[d]).html(g)}}}});h.defaults={trace:!1,rowHeight:"auto",serverWait:200,displayBuffer:9,boundaryScale:0.5,loadingIndicator:!1};h.oDefaults=h.defaults;h.version="1.4.1";"function"==typeof e.fn.dataTable&&"function"==typeof e.fn.dataTableExt.fnVersionCheck&&e.fn.dataTableExt.fnVersionCheck("1.10.0")?
|
||||
e.fn.dataTableExt.aoFeatures.push({fnInit:function(a){var b=a.oInit;new h(a,b.scroller||b.oScroller||{})},cFeature:"S",sFeature:"Scroller"}):alert("Warning: Scroller requires DataTables 1.10.0 or greater - www.datatables.net/download");e(i).on("preInit.dt.dtscroller",function(a,b){if("dt"===a.namespace){var c=b.oInit.scroller,d=m.defaults.scroller;if(c||d)d=e.extend({},c,d),!1!==c&&new h(b,d)}});e.fn.dataTable.Scroller=h;e.fn.DataTable.Scroller=h;var k=e.fn.dataTable.Api;k.register("scroller()",function(){return this});
|
||||
k.register("scroller().rowToPixels()",function(a,b,c){var d=this.context;if(d.length&&d[0].oScroller)return d[0].oScroller.fnRowToPixels(a,b,c)});k.register("scroller().pixelsToRow()",function(a,b,c){var d=this.context;if(d.length&&d[0].oScroller)return d[0].oScroller.fnPixelsToRow(a,b,c)});k.register("scroller().scrollToRow()",function(a,b){this.iterator("table",function(c){c.oScroller&&c.oScroller.fnScrollToRow(a,b)});return this});k.register("row().scrollTo()",function(a){var b=this;this.iterator("row",
|
||||
function(c,d){if(c.oScroller){var e=b.rows({order:"applied",search:"applied"}).indexes().indexOf(d);c.oScroller.fnScrollToRow(e,a)}});return this});k.register("scroller.measure()",function(a){this.iterator("table",function(b){b.oScroller&&b.oScroller.fnMeasure(a)});return this});k.register("scroller.page()",function(){var a=this.context;if(a.length&&a[0].oScroller)return a[0].oScroller.fnPageInfo()});return h});
|
||||
|
||||
Reference in New Issue
Block a user