About modify data row object

About modify data row object

sergio.amssergio.ams Posts: 6Questions: 3Answers: 0

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

  • jvretamerojvretamero Posts: 26Questions: 0Answers: 3
    Answer ✓

    When I modify the property value of data object row, in automatically modify in the DataTable JavaScript Object?

    No, DataTables holds cached information (see row().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.

  • sergio.amssergio.ams Posts: 6Questions: 3Answers: 0

    Thanks.

This discussion has been closed.