fnReloadAjax: Update to be comaptible with 1.10.

- Although 1.10 has its own Ajax reloading options built in, it makes
  sense to have fnReloadAjax work with 1.10 for old installations, so
  you can simply replace the plug-in rather than reworking all exisiting
  code!
gh-pages
Allan Jardine 11 years ago
parent 8f9e269a5c
commit 9323ccdd67

@ -17,6 +17,21 @@
$.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw ) $.fn.dataTableExt.oApi.fnReloadAjax = function ( oSettings, sNewSource, fnCallback, bStandingRedraw )
{ {
// DataTables 1.10 compatibility - if 1.10 then `versionCheck` exists.
// 1.10's API has ajax reloading built in, so we use those abilities
// directly.
if ( $.fn.dataTable.versionCheck ) {
var api = new $.fn.dataTable.Api( oSettings );
if ( sNewSource ) {
api.ajax.url( sNewSource ).load( fnCallback, !bStandingRedraw );
}
else {
api.ajax.reload( fnCallback, !bStandingRedraw );
}
return;
}
if ( sNewSource !== undefined && sNewSource !== null ) { if ( sNewSource !== undefined && sNewSource !== null ) {
oSettings.sAjaxSource = sNewSource; oSettings.sAjaxSource = sNewSource;
} }

Loading…
Cancel
Save