Cannot sort table when hiding duplicate rows
Cannot sort table when hiding duplicate rows
Link to test case: https://jsfiddle.net/Andska/o2hzws5n/11/
Debugger code (debug.datatables.net): uwunac
Error messages shown: No matching records found
Description of problem: I want to hide rows with duplicate values and be able to sort by any column after removing the duplicate rows. When I hide duplicates with the current function it removes duplicates correctly, but it won't let me sort with the new data (which has no duplicates). Any suggestions?
This question has an accepted answers - jump to answer
Answers
Neat one that - thanks for the test case!
The problem is that on each draw the
office
array is not being reset. So when the table is next redraw, it finds entries in theoffice
array for the items that should be shown and filters them out!What we need to do is reset the filter when a draw happens. That can be done with the index counter for the filter array. https://jsfiddle.net/dgvL0pqy/2/ .
Allan
Thank you for the solution, Allan.