Best way to purge/hard reset the table data?

Best way to purge/hard reset the table data?

growe19growe19 Posts: 18Questions: 6Answers: 0
edited April 2022 in General

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 ) { 

    //how do i reload the same source I killed


Link to test case:
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


  • rf1234rf1234 Posts: 2,594Questions: 80Answers: 375
    edited April 2022 Answer ✓

    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:

    var initDataTable = function() {
        if ( $.fn.DataTable.isDataTable( '#yourTable' ) ) {
        ... init your data table ...

    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.

    destroy: true

Sign In or Register to comment.