1
0
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:
Allan Jardine 2013-10-11 16:09:19 +01:00
parent 8f975060d8
commit 4e05760b20
2 changed files with 12 additions and 6 deletions

View File

@ -1 +1 @@
f3bb71cfed8f31c1cc4fcf797efde0ba5246ac78
ba7b99443fcd45f1ab7555e046188ee7cd559eb3

View File

@ -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 );
} );
} );