Sort column click sequence
Sort column click sequence
Hi There,
I am using DataTables 1.10 and have set my initial default sort on my table successfully.
I am looking to be able to sort the first two columns in an "asc", "desc" sequence when clicked, but all other columns should sort in a "desc", "asc" sequence.
I can get first to columns working using
"columnDefs": [{ "orderSequence": [ "asc", "desc" ], "targets":[0,1]}]
but cannot get all other columns to sort on the reverse sequence.
If I only have 3 columns
"columnDefs": [{ "orderSequence": [ "asc", "desc" ], "targets":[0,1]}, { "orderSequence": [ "desc", "asc" ] , "targets":[2]}]
works. But my number of columns is dynamic so I cannot list the columns in targets.
Any help would be appreciated.
Cheers
Eddie
This question has an accepted answers - jump to answer
Answers
It's Ok. Got it.
Just changed to be
"columnDefs": [{ "orderSequence": [ "asc", "desc" ], "targets":[0,1]}, { "orderSequence": [ "desc", "asc" ] , "targets":["_all"]}]