mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-29 11:24:10 +01:00
New: Add callback function to the ajax.url().load() and ajax.reload()
methods
This commit is contained in:
parent
8f975060d8
commit
4e05760b20
@ -1 +1 @@
|
||||
f3bb71cfed8f31c1cc4fcf797efde0ba5246ac78
|
||||
ba7b99443fcd45f1ab7555e046188ee7cd559eb3
|
||||
|
16
media/js/jquery.dataTables.js
vendored
16
media/js/jquery.dataTables.js
vendored
@ -6715,7 +6715,7 @@
|
||||
|
||||
var _Api = DataTable.Api;
|
||||
|
||||
var _reload = function ( settings, holdPosition ) {
|
||||
var _reload = function ( settings, holdPosition, callback ) {
|
||||
if ( settings.oFeatures.bServerSide ) {
|
||||
_fnReDraw( settings, holdPosition );
|
||||
}
|
||||
@ -6731,6 +6731,10 @@
|
||||
}
|
||||
|
||||
_fnReDraw( settings, holdPosition );
|
||||
|
||||
if ( callback ) {
|
||||
callback( json );
|
||||
}
|
||||
} );
|
||||
}
|
||||
};
|
||||
@ -6763,9 +6767,9 @@
|
||||
* called, which is why the pagination reset is the default action.
|
||||
* @returns {DataTables.Api} this
|
||||
*/
|
||||
_Api.register( 'ajax.reload()', function ( resetPaging ) {
|
||||
_Api.register( 'ajax.reload()', function ( callback, resetPaging ) {
|
||||
return this.iterator( 'table', function (settings) {
|
||||
_reload( settings, resetPaging===false );
|
||||
_reload( settings, resetPaging===false, callback );
|
||||
} );
|
||||
} );
|
||||
|
||||
@ -6823,10 +6827,12 @@
|
||||
*
|
||||
* @returns {DataTables.Api} this
|
||||
*/
|
||||
_Api.register( 'ajax.url().load()', function () {
|
||||
_Api.register( 'ajax.url().load()', function ( callback ) {
|
||||
// Same as a reload, but makes sense to present it for easy access after a
|
||||
// url change
|
||||
return this.iterator( 'table', _reload );
|
||||
return this.iterator( 'table', function ( ctx ) {
|
||||
_reload( ctx, undefined, callback );
|
||||
} );
|
||||
} );
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user