[Solved] Refresh modifications on data or on table
[Solved] Refresh modifications on data or on table
Hi,
I use DataTables to manage "starred" element.
I construct in PHP the table and after I call DataTables.
In my table, I have a column with a button on each lines for "starring" and if the line is starred, I display another button for remove this one.
I have an invisible column with "0" or "1" to filter only element has "starred" or not.
I have a filter for display only starred elements or not. The filter works fine.
BUT...
If I change the state of the line (not starred => starred) I change the invisible column from "0" to "1" but if I check with my checkbox filter, the new element was not recognized by DataTables.
For example I made the change in myTable.data()[0][3] = "1";
If I make a draw()
after that, I have the same problem.
My only solution : I need to destroy DataTables and recreate one but if I do that I lost the current page and filter.
I don't know if my english is ok. Please be indulgent.
Answers
I modified my script to use ajax.url & ajax.dataSrc for use after myTable.reload and with that, that's work.