Server-controlled data updates
Server-controlled data updates
Hello,
As far as I understood the DT.net functionality, with server-side processing enabled, the DataTables data flow is originated from the client, which produces AJAX requests, containing current table state and draw number, which server handles and returns the data for update. Please, correct me, if I am missing some important point.
My question is: would it be possible to set up a backward data flow? The server is generating the data in the real time and sending the updates to the client either occasionally, when data is changed, or within fixed intervals. What would be the best way to set DT up and make it to maintain these constant updates, at the same time keeping the client-server data flow possible, when user uses pagination or search functionality?
Thanks in advance!
This question has an accepted answers - jump to answer
Answers
Datatables provides client side methods that can be used to update the client table, like
rows.add()
. However if you are using server side processing these methods are not enabled because Datatables expects all data processing to be performed by the server.If you used client side processing instead you could update the Datatable with realtime updates from the server. Receiving realtime updates from the server is not something Datatables would handle. You will need to find a library to receive the updates then use something like
rows.add()
to add the updates to the Datatable.Kevin
With server side processing you could update the server data realtime then send a signal to the client using a third party library. When the client receives the signal use
ajax.reload()
to reload the current table page.Kevin
Thank you very much for answering, I was expecting something like that, but now I can be sure that there is no simpler way of resolving that issue.