Sort the datatable using select box with two different hidden columns

Sort the datatable using select box with two different hidden columns

jasonranajasonrana Posts: 1Questions: 1Answers: 0

I have select box having two options and I want to sort it by option using values of a hidden column. Suppose if I have three columns two of them are hidden columns, so if I select an option A it must sort by hidden column 2 and if select option B it must sort by hidden column 3. I did a workaround by order([column,’desc’]).draw() it working but column 1 still has default ordering.

Answers

  • kthorngrenkthorngren Posts: 21,147Questions: 26Answers: 4,918

    Without seeing it its hard to say what the problem is. Can you post a link to your page or provide a simple test case replicating the problem?
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Assuming the variable column in order([column,’desc’]).draw() is either 2 or 3 then it should only sort by that column. What do the sorting arrows show?

    Keep in mind that the column numbers start at 0. So for three columns you have column numbers 0, 1 and 2.

    Kevin

This discussion has been closed.