Refresh data without ajax

Refresh data without ajax

CybouletteCyboulette Posts: 1Questions: 1Answers: 0

Hello,

I use a custom API in order to make calls and pass data to my datatables. I don't use the ajax() method of DataTable but i initialize my Datatable with columns and data parameters. (JSON).

I use the API with .row/.rows/.data/.add in order to manipulate my rows when I received data from the server (in fact is websocket API).

I need to "re-execute" the render of data, because data is updated by websocket and sometimes all data are replaced.
Currently I found a way to do it :
- I Use the api with .rows().every() in order to loop data
- In the loop I use : this.data(this.data()); in order to "re-render" the data
- After the loop I use draw() for reload.

I want to know if a "propper" way it's possible ?
I think it's mandatory to use data() method in order to update data(), but maybe it exists a data().refresh(), or table.reload();
Because the .draw() simply draw the table with the data but doesn't reload the data().

Thank's.

This discussion has been closed.