About modify data row object
About modify data row object
I have a little question about when modify DataTable data row.
For example:
// Object DataTable get data row
var dataCell = Dtable.row(row).data();
dataCell.id = 10;
When I modify the property value of data object row, in automatically modify in the DataTable JavaScript Object? And is not necessary to do
Dtable.row(row).data(dataCell);
Dtable.row(row).invalidate(); // Is necessary to Add .draw() when invalidate()?
// Or to do
Dtable.rows().invalidate(); // Is necessary to Add .draw() when invalidate()?
I understood what I need to execute .draw() when I want to update the DOM, but is not clear for me how works .invalidate() and if the data row object is modify automatically modify de JavaScript Object contained by DataTable instance.
I'm waiting for you feedback.
This question has an accepted answers - jump to answer
Answers
No,
DataTables
holds cached information (seerow().invalidate()
).Yes, you have to call the
draw()
method to draw the table with the new values.I advise you to call the
draw()
method only after you do all the data modification, this way you'll draw the table only once.Thanks.