DataTables Ajax Reload Data

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.