Cannot sort table when hiding duplicate rows

Cannot sort table when hiding duplicate rows

AndskaAndska Posts: 3Questions: 2Answers: 0
edited September 2022 in Free community support

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

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    Answer ✓

    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 the office 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

  • AndskaAndska Posts: 3Questions: 2Answers: 0

    Thank you for the solution, Allan.

Sign In or Register to comment.