Documentation for aaSorting slightly unclear

Documentation for aaSorting slightly unclear

dharknessdharkness Posts: 8Questions: 0Answers: 0
edited January 2010 in Bug reports
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."

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Sounds good to me! Clearer documentation is always welcome, and documentation bugs can sometimes be more horrible (for the people using them) than software bugs!

    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
  • dharknessdharkness Posts: 8Questions: 0Answers: 0
    Great, glad I could help. :)

    Minor correction, "4th column" instead of "4rd column" in the code's comment. Otherwise you might get a C&D letter from Ford. :p
  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Oops... :-). Thanks for catching that as well.

    Allan
This discussion has been closed.