how to force update of datatables

how to force update of datatables

yshtilyshtil Posts: 17Questions: 6Answers: 0

I have three tables that are fed from a server via ajax. The server gets the data from a database that is updated periodically.
How can the server force refresh the tables if a change in the database is detected?

Answers

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,769

    If you are using the ajax option then use ajax.reload() to refresh the Datatables data.

    Kevin

  • yshtilyshtil Posts: 17Questions: 6Answers: 0

    But how I notify the client that the database changed? I don't want to use setInterval API to bombard the server unnecessarily.

  • kthorngrenkthorngren Posts: 20,309Questions: 26Answers: 4,769

    There is nothing built into Datatables for this. There are environments, like node.js, that allow for pushing data from the server to the client to invoke event handlers. You will need to look at documentation or use forums like Stack Overflow to research how to do this for your environment.

    Kevin

Sign In or Register to comment.