mirror of
https://github.com/DataTables/DataTables.git
synced 2024-12-01 13:24:10 +01:00
New: Allow state loading to be cancelled from the aoStateLoadParams callbacks by returning false (matches the capabilities of the old state loading methods)
This commit is contained in:
parent
1bdbe86da2
commit
f702ac5648
20
media/js/jquery.dataTables.js
vendored
20
media/js/jquery.dataTables.js
vendored
@ -4277,8 +4277,14 @@
|
||||
return;
|
||||
}
|
||||
|
||||
/* Allow custom and plug-in manipulation functions to alter the saved data set */
|
||||
_fnCallbackFire( oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData] );
|
||||
/* Allow custom and plug-in manipulation functions to alter the saved data set and
|
||||
* cancelling of loading by returning false
|
||||
*/
|
||||
var abStateLoad = _fnCallbackFire( oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData] );
|
||||
if ( $.inArray( false, abStateLoad ) !== -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store the saved state so it might be accessed at any time */
|
||||
oSettings.oLoadedState = $.extend( true, {}, oData );
|
||||
@ -8343,6 +8349,16 @@
|
||||
* oData.oFilter.sSearch = "";
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Disallow state loading by returning false
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateLoadParams": function (oSettings, oData) {
|
||||
* return false;
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnStateLoadParams": null,
|
||||
|
||||
|
@ -55,8 +55,14 @@ function _fnLoadState ( oSettings, oInit )
|
||||
return;
|
||||
}
|
||||
|
||||
/* Allow custom and plug-in manipulation functions to alter the saved data set */
|
||||
_fnCallbackFire( oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData] );
|
||||
/* Allow custom and plug-in manipulation functions to alter the saved data set and
|
||||
* cancelling of loading by returning false
|
||||
*/
|
||||
var abStateLoad = _fnCallbackFire( oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData] );
|
||||
if ( $.inArray( false, abStateLoad ) !== -1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Store the saved state so it might be accessed at any time */
|
||||
oSettings.oLoadedState = $.extend( true, {}, oData );
|
||||
|
@ -988,6 +988,16 @@ DataTable.defaults = {
|
||||
* oData.oFilter.sSearch = "";
|
||||
* } );
|
||||
* } );
|
||||
*
|
||||
* @example
|
||||
* // Disallow state loading by returning false
|
||||
* $(document).ready(function() {
|
||||
* $('#example').dataTable( {
|
||||
* "bStateSave": true,
|
||||
* "fnStateLoadParams": function (oSettings, oData) {
|
||||
* return false;
|
||||
* } );
|
||||
* } );
|
||||
*/
|
||||
"fnStateLoadParams": null,
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user