Best way to purge/hard reset the table data?
Best way to purge/hard reset the table data?
I've noticed on the odd occassion my table displaying two sets of data from my ajax/json/localhost source. I'm pointing the fingure at the API app I'm using but to be sure I'd like to have a button for a hard reset of the table data.
Is it possible to have a button to reset the source?
{
text: 'Reset Table',
action: function ( e, dt, node, config ) {
table.destroy();
//how do i reload the same source I killed
}
},
Link to test case: https://garyrowe.co.uk/acc/?mode=live&hide=0&order=1&class=
If you would like data to appear you will need the sim racing game Assetto Corsa Competizione, SimHub and the Swoop plug-in for SimHub.
This question has an accepted answers - jump to answer
Answers
You can just wrap the data table into a function. You call the function and the data table gets initialized. Just destroy it before you call the function again. Or do something like this:
Alternatively you can add this option to your dt configuration. Then you can call the function as many times as you like. Your table always gets destroyed and rebuilt.
https://datatables.net/reference/option/destroy