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.
Join them; it only takes a minute:
|
|||||||||
|
There are a couple of options:
|
|||||||||||||||||||||
|
Here is the actual code that does it...
To not have the column highlighted, modify the CSS like so:
|
|||||||||||||||||||||
|
You can use the fnSort function, see the details here: |
|||
|
Best option is to disable sorting and just feed data with desired sort order (from database or other source). Try to add this to your 'datatable': "bSort": false |
||||
|
Datatables supports HTML5 data-* attributes for this functionality. It supports multiple columns in the sort order (it's 0-based)
Now my jQuery is simply Here's some other nice attributes for the
|
||||
|
I had this problem too. I had used |
|||
|