Ordering by two or more columns by user
Ordering by two or more columns by user
I have a table that by default is ordered by column 16 descending. If a user clicks on a second column, how do I keep column 16 as a secondary order?
For example, if column 16 is number of 'Goals' scored by a list of football players, and then the user chooses to order a second column in that table called 'Appearances', assuming several players have made the same amount of appearances, how do you make them ordered by goals scored?
This question has an accepted answers - jump to answer
Answers
Well, there is https://datatables.net/examples/basic_init/multi_col_sort.html
But I think you'll have to click the columns in the order you want them. So click on the primary column first, then shift click secondary, tertiary and so on columns.
As @kc5151 says, the user can shift click. However, if you want a secondary sort column automatically, use
columns.orderData
as an array.Allan