Optimize updating multiple rows by rowId
Optimize updating multiple rows by rowId
Tablefak
Posts: 35Questions: 8Answers: 0
I wrote a code to update data in multiple rows using the rowId as selector. Is there a way to optimize this code for speed?
changedData.forEach(i => {
table.row("#" + i).data(i)
})
table.draw()
I'm thinking I should not redraw the whole table but only the changed rows. However, I'm not sure how to do that in the most efficient way using the datatables api.
This question has an accepted answers - jump to answer
Answers
Calling
draw()
will apply sorting and searching to the table based on the changes made. Calling it once after the loop is about as efficient as you will get.Kevin
Thanks!