update data without distroy
update data without distroy
davidjpage
Posts: 1Questions: 1Answers: 0
Is there a way to update the data in the DataTable without doing a destroy and re-initializing the table? My data is an array I'm getting from a web API call.
This discussion has been closed.
Answers
You could add a class to every TD, and a unique id to every TR - server side example of this. Then use jQuery to replace the text of the desired cells.
You can also add the ID to each TR when initializing your datatable if you would rather do it this way, or if you aren't using server side processing.
Also, if your table is Ajax sourced, use the
ajax.reload()
method. There is alsoclear()
androws.add()
if you have the data already client-side.Allan