简体   繁体   中英

Improve performance updating the DOM using Datatables jQuery plugin

I wonder if there's any way to speed up fnUpdate function when applying it to many rows. In my case I am using it to update for example 10 cells of 10 different rows and I am noticing it is not so fast as expected. Its a bit laggy.

I've seen than a common technique to improve the performance when updating the DOM is to to do it at once instead of looping. This way, the browser will only reflow the page once and will speed up the process.

Is there any way to do it in datatables plugin making of of fnUpdate function ? Thanks.

It might be helpful that you try the 4th and 5th option of fnUpdate, which disables updating the entire table right after updating the cell. You can do the whole table update when all changes are done.

for(i = 0; i < rows ; i++)
{
dataTable.fnUpdate( "Sample Data", i, 3, false, false );
}
dataTable.fnDraw();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM