Wednesday, June 5, 2024
 Popular · Latest · Hot · Upcoming
23
rated 0 times [  26] [ 3]  / answers: 1 / hits: 117322  / 13 Years ago, mon, december 26, 2011, 12:00:00

I am trying to set the default sort to the second column in my jquery datatable. It by default sorts by index 0. I am using the aaSorting: [[ 1, asc ]] syntax but it highlights the column which I don't want on initial load. How can I set the default sort of a specific column without it highlighting the column as if no sorting was involved and the 0 index column was being used.


More From » jquery

 Answers
26

There are a couple of options:




  1. Just after initialising DataTables, remove the sorting classes on the TD element in the TBODY.


  2. Disable the sorting classes using http://datatables.net/ref#bSortClasses . Problem with this is that it will disable the sort classes for user sort requests - which might or might not be what you want.


  3. Have your server output the table in your required sort order, and don't apply a default sort on the table (aaSorting:[]).



[#88367] Saturday, December 24, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
gageherberth

Total Points: 249
Total Questions: 115
Total Answers: 119

Location: Liechtenstein
Member since Sun, Sep 12, 2021
3 Years ago
;