Documentation for aaSorting slightly unclear
Documentation for aaSorting slightly unclear
![dharkness](https://secure.gravatar.com/avatar/9462edf139e6a4a74a19dcd536dcb26d/?default=https%3A%2F%2Fvanillicon.com%2F9462edf139e6a4a74a19dcd536dcb26d_200.png&rating=g&size=120)
Not so much a bug as a suggestion for clearer documentation of the aaSorting option. The sentence
"For each column an array must be specified where the first element is an int of the data index"
is a little unclear. It seems at first read to me to require that the array has an element for every column in the table (each column) rather than for each column you wish to have initially sorted. I even thought to myself that the way it actually works is how it should work, and of course I tried that method after what I understood didn't work. :)
Perhaps
"This array should contain an array for each column to be sorted initially containing the column's index and a direction string ('asc' or 'desc')."
Also, an example that doesn't use the 0th and 1st columns might better illustrate the feature.
"Example: "[[2,'asc'], [1,'asc']]" will sort by the 3rd and 2nd columns."
"For each column an array must be specified where the first element is an int of the data index"
is a little unclear. It seems at first read to me to require that the array has an element for every column in the table (each column) rather than for each column you wish to have initially sorted. I even thought to myself that the way it actually works is how it should work, and of course I tried that method after what I understood didn't work. :)
Perhaps
"This array should contain an array for each column to be sorted initially containing the column's index and a direction string ('asc' or 'desc')."
Also, an example that doesn't use the 0th and 1st columns might better illustrate the feature.
"Example: "[[2,'asc'], [1,'asc']]" will sort by the 3rd and 2nd columns."
This discussion has been closed.
Replies
I've taken your text, almost verbatim, and put it in. The example code has also been updated: http://datatables.net/usage/options#aaSorting
Regards,
Allan
Minor correction, "4th column" instead of "4rd column" in the code's comment. Otherwise you might get a C&D letter from Ford. :p
Allan