row().data() seems to trigger partial update/draw
row().data() seems to trigger partial update/draw
Using something like row.data({0: "New Name"}); seems to update the row in the table despite not calling .draw() explicitly. Is there a way around this? When not calling draw it updates the row but without triggering the cells (custom) render function. I want to manipulate the data and then draw all the changes at once.
I was attempting to create a test case at http://live.datatables.net/gikumabo/1/edit but the website is telling me "too many redirects" all of a sudden.
This question has an accepted answers - jump to answer
Answers
Are you saying you want to update the table data without updating the table's display until you call
draw()
? I don't believe Datatables has an option for this.Please describe the problem you are trying to solve.
Kevin
That's exactly what I thought was possible. The last example here looked like it would be just that: https://datatables.net/reference/api/row().data()
In my case, one of the custom formatters is adding an <img> in a TD and I want to refrain from re-drawing the row until all data is updated. I can change my internal function to keep the data object at hand until I'm ready to draw so it's non-issue, but the documentation led me to believe I could update the data and postpone the draw.
When I update the data, the <td> suddenly contains the URL to the image. Only when I call draw() is the formatter applied and it turns to <img>.
This is from the
row().data()
docs:The first part indicates that the HTML table will updated. The Datatables cache is what keeps track of sorting, searching and paging. This is updated once
draw()
is called and the HTML table will reflect the data cache sorting, searching and paging.Sounds like a good solution.
Kevin