draw() and initCompete
draw() and initCompete
kevin2
Posts: 3Questions: 1Answers: 0
Hello, I'm using table.api().draw() to read new data through ajax for a table. But this function does not call initComplete again. How to force a table to completely redraw with an initComplete call?
This discussion has been closed.
Answers
initCompleteruns only once after the Datatable has initialized. You will need to move the code to a more appropriate event so it runs when desired. Thedrawevent may work for your needs.Kevin
Thanks, I'm using initComplete because I need the data received from the server via ajax initComplete(settings, json). Can you suggest what other event can accept the same input data?
The
xhrevent has ajsonparameter. You can also use theajax.json()API to read the current JSON data.Kevin
If you use ajax.reload() to reload the table you can use the callback to access the data read from the server.
https://datatables.net/reference/api/ajax.reload()
json.data is the array with the rows read from the server if you use Editor.
Thank you