Sorting in Each column Not working

Sorting in Each column Not working

Uzairkhan92Uzairkhan92 Posts: 36Questions: 10Answers: 0

Link to test case:
https://jsfiddle.net/4vnqhwsy/9/
Debugger code (debug.datatables.net):
Error messages shown:
Description of problem:

I want to filter data in each column, right now it's working, but when I am trying to filter volume in the second column so previous column filter gets removed.

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    There are a couple main issues with the code:

    1. The mainObject variable doesn't seem to be correct. Its not holding the search values for all the columns. It only keeps the values for the last column.
    2. The search plugin needs to loop through the relevant data parameter elements for all the columns that need to be searched.

    Take a look at this example from this thread. The idea with this example is it keeps track of the search state for all the checkbox columns. The search plugin loops through all the active checkbox search columns to filter the rows.

    Have you looked at SearchBuilder?

    Kevin

  • Uzairkhan92Uzairkhan92 Posts: 36Questions: 10Answers: 0

    Can you please fix it for my mainObject?

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954
    edited January 2023

    Its not a simple fix and would take some time. My suggestion is to look at making it an object where the key is the column index and the value is an object containing the search type and value. In the search plugin loop through the object using the key to get the column data for the evaluation. Similar to the checkbox example I linked to.

    Kevin

Sign In or Register to comment.