Problem using yadcf.exResetAllFilters in my AJAX response

Problem using yadcf.exResetAllFilters in my AJAX response

lenamtllenamtl Posts: 265Questions: 65Answers: 1

Based on my previous question
https://datatables.net/forums/discussion/comment/110975/#Comment_110975

I still have problem to reset Yadcf filter when deleting a row

I'm deleting the row using PHP and Ajax.
I'm not using server side datatable version.

The problem I have is when the Yadcf filtered value (select2) get deleted by my script.
The search value stay in the LocalStorage and show nothing found, so I need to update the localstorage by doing a Yadcf reset...
So I'm trying to use yadcf.exResetAllFilters();

Here is the code I'm using in my ajax code is on a seperate JS file and cannot be on the same page...
The Datatables code is working fine, but not yadcf.exResetAllFilters

success: function(response) {
    $("#files-list").DataTable().rows($("#"+rowId)).remove()
    yadcf.exResetAllFilters(table16);
    $("#files-list").DataTable().search("").draw();
},

I'm getting
Uncaught ReferenceError: table16 is not defined
Any clue how to fix this?

PS when using yadcf.exResetAllFilters with the click of a button (on the same page it is working fine).

Thanks

Answers

  • lenamtllenamtl Posts: 265Questions: 65Answers: 1

    I finally found a solution by setting all columns search to empty instead of using
    the Yadcf reset. This way the localstorage get updated.

    success: function(response) {
        $("#files-list").DataTable().rows($("#"+rowId)).remove()
        $("#files-list").DataTable().search("").columns().search("").draw();
    },
    
This discussion has been closed.