Refresh DIV
Refresh DIV
Hi All
I have a DT inside a DIV and i want the DIV to be refreshed. Why?
When i click on the DT row, i retrieve dynamical data from the DB and and display on a modal. My Issue is that the query is only done once, If i click on a diferent row, it cashes the data of the previous query, so it doesnt update the values unless i refresh the page. I tried doing a table.reload.ajax() however even after reloading the DT, i still get the same behaviour where it does not query the DB with diferent ID. So the solution is to have some sort of refresh done by jquery however i dont want to refresh the whole page, only the DIV containing the DT.
Can someone point me to a solution on that?
Replies
Maybe you just need to use
row().invalidate()
to refresh the updated row.Kevin
Hi Kthorngren
Thank you for your quick reply, i tried that and it did not work for me.
$('#modal-edit').on('hidden.bs.modal', function () { // Here i want to refresh only the DIV that contains the DT and not the entire page. });What i want is to call an action when i hide the modal that displayes the user data.
See below:
You can call the
destroy()
method to destroy an existing DataTable and then create a new one. If you want to completely replace the table's HTML you should call the destroy method before removing the HTML to make sure there are no memory leaks.Allan