mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-02 14:24:11 +01:00
New: New callback function fnPreDrawCallback which is called at the very start of each table draw (so rather like fnDrawCallback, just before the
draw!). This function is, like all other DataTables callbacks, execuated with the DataTables instance scope, and also takes a single parameter - the DataTables settings object. The attached function can cancel the draw by returning false, anyother return (including undefined) results in the full draw occuring).
This commit is contained in:
parent
a84eec581b
commit
8eafb87f1e
16
media/js/jquery.dataTables.js
vendored
16
media/js/jquery.dataTables.js
vendored
@ -1135,6 +1135,14 @@
|
||||
*/
|
||||
this.aoDrawCallback = [];
|
||||
|
||||
/*
|
||||
* Variable: fnPreDrawCallback
|
||||
* Purpose: Callback function for just before the table is redrawn. A return of false
|
||||
* will be used to cancel the draw.
|
||||
* Scope: jQuery.dataTable.classSettings
|
||||
*/
|
||||
this.fnPreDrawCallback = null;
|
||||
|
||||
/*
|
||||
* Variable: fnInitComplete
|
||||
* Purpose: Callback function for when the table has been initalised
|
||||
@ -3188,6 +3196,13 @@
|
||||
var iStrips = oSettings.asStripClasses.length;
|
||||
var iOpenRows = oSettings.aoOpenRows.length;
|
||||
|
||||
/* Provide a pre-callback function which can be used to cancel the draw is false is returned */
|
||||
if ( oSettings.fnPreDrawCallback !== null &&
|
||||
oSettings.fnPreDrawCallback.call( oSettings.oInstance, oSettings ) === false )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
oSettings.bDrawing = true;
|
||||
|
||||
/* Check and see if we have an initial draw position from state saving */
|
||||
@ -6907,6 +6922,7 @@
|
||||
_fnMap( oSettings.oScroll, oInit, "iScrollLoadGap", "iLoadGap" );
|
||||
_fnMap( oSettings.oScroll, oInit, "bScrollAutoCss", "bAutoCss" );
|
||||
_fnMap( oSettings, oInit, "asStripClasses" );
|
||||
_fnMap( oSettings, oInit, "fnPreDrawCallback" );
|
||||
_fnMap( oSettings, oInit, "fnRowCallback" );
|
||||
_fnMap( oSettings, oInit, "fnHeaderCallback" );
|
||||
_fnMap( oSettings, oInit, "fnFooterCallback" );
|
||||
|
Loading…
Reference in New Issue
Block a user