To return data to the backend, the first way is to
Regenerate a DataTable object, but there is a flicker in each click Refresh, and the cost is high. Ideally, you should just update the data.
Finally found a plugin in the document Fnreloadajax add File
$.fn.datatableext.oapi.fnreloadajax = function (osettings, Snewsource, Fncallback, Bstandingredraw)
{
if (snewsource!== undefined && s newsource!== null) {
Osettings.sajaxsource = Snewsource;
}
Server-side processing should just call Fndraw
if (oSettings.oFeatures.bServerSide) {
This.fndraw ();
Return
}
This.oapi._fnprocessingdisplay (osettings, true);
var = this;
var iStart = Osettings._idisplaystart;
var aData = [];
This.oapi._fnserverparams (osettings, aData);
OSettings.fnServerData.call (Osettings.oinstance, Osettings.sajaxsource, AData, function (JSON) {
/* Clear The old information from the table */
That.oapi._fncleartable (osettings);
/* Got The Data-add it to the table */
var aData = (Osettings.sajaxdataprop!== "")?
That.oapi._fngetobjectdatafn (Osettings.sajaxdataprop) (JSON): JSON;
for (var i=0; i<adata.length; i++)
{
That.oapi._fnadddata (Osettings, adata[i]);
}
Osettings.aidisplay = OSettings.aiDisplayMaster.slice ();
That.fndraw ();
if (Bstandingredraw = = = True)
{
Osettings._idisplaystart = IStart;
That.oapi._fncalculateend (osettings);
That.fndraw (FALSE);
}
That.oapi._fnprocessingdisplay (osettings, false);
/* Callback user Function-for Event handlers etc */
if (typeof fncallback = = ' function ' && fncallback!== null)
{
Fncallback (osettings);
}
}, Osettings);
};
How to use
Otable.fnreloadajax (' pages/getplayernewdata.php);
Otable.fnreloadajax (); Use the default
http://yuklog.lofter.com/post/70cbd_8b6706
DataTables Ajax Reload Data