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.
We started with Q&A. Technical documentation is next, and we need your help.
Whether you're a beginner or an experienced developer, you can contribute.
|
|||||||||
|
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 |
||||
|