saveState / StateRestore + searchList : filters do not reapply correctly
saveState / StateRestore + searchList : filters do not reapply correctly
EDAC
Posts: 3Questions: 0Answers: 0
Link to test case:
https://live.datatables.net/zoqeruze/1/edit?js,output
Debugger code (debug.datatables.net): N/A
Error messages shown: N/A
Description of problem:
When using searchList, filters (either from saveState or StateRestore) are not properly applied when loading a saved state.
Steps to reproduce:
- Define a text filter for "Position" (I used "en", which shows in 13 entries out of 57).
- Use "Create State" to save the state (this will now be State 1).
- Clear the filters.
- Select a city for "Office" (I used "Edinburgh", which has 19 entries)
- Use "Create State" to save the state (this will now be State 2).
- Clear the filters.
- Click "Saved States", then "State 1" to restore the "Position" filter. The filter will apply successfully (showing 13 entries again).
- Clear the filters.
- Click "Saved States", then "State 2" to restore the "Office" filter.
At this point:
- If you click on "Saved States" again, "State 2" has a check box as if it is applied.
- If you click on the Position filter, Edinburgh has a check box as if it is applied.
- However, the table does not apply the filter. All rows are displayed.
I have also had users report that columns using "searchList" will occasionally reset their filters (saved using saveState)... I suspect that the two issues are related, but it's easier to reproduce using the StateRestore buttons.
Replies
Update: I did some more digging into this and think I found a fix, submitted as:
https://github.com/DataTables/ColumnControl/pull/1
Sorry I missed this thread at the time. Your fix is merged in now - many thanks for sending it in
Allan