Shubhangi Garg
Shubhangi Garg

Reputation: 127

How can I sort jquery-datatable by two columns?

I have one datatable which I created using jQuery. It has five column and I am sorting it by its third column. like this:

 "aaSorting": [[2, 'desc']]

So, My query is this: If two rows have the same data for column third, then I want to sort those rows by some other column. How can I do that?

Upvotes: 0

Views: 1246

Answers (1)

Gyrocode.com
Gyrocode.com

Reputation: 58860

You can specify more than one column with aaSorting option (DataTables 1.9) or order option (DataTables 1.10+).

For example:

"aaSorting": [[2, 'desc'], [3, 'asc']]

Upvotes: 2

Related Questions