No sort by default

No sort by default

MonicoMonico Posts: 6Questions: 0Answers: 0
edited January 2010 in General
Hy all,

I have a new problem. I would like no sort by default. Here, it's the first column who are sort but I can't find a solution for no sort but I want to keep the possibility to sort my columns after :)

Is it possible ?

Thank you

Replies

  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Monico,

    Please see this thread: http://datatables.net/forums/comments.php?DiscussionID=1121

    Allan
  • MonicoMonico Posts: 6Questions: 0Answers: 0
    Thank you for this answer.

    I see this option "aaSorting" but unless I am mistaken, I need to put asc or desc but no "null". So one of my column must be sorted whereas I want no sort on no colum at the pre initalisation.

    Maybe I misunderstood...

    Thank you for your help !
  • allanallan Posts: 63,498Questions: 1Answers: 10,470 Site admin
    Hi Monico,

    To have no sort by default (other than the original table order), but to keep sorting enabled, such that the end user can click the column titles, you just need to set aaSorting to be an empty array. If you wanted the second column to be sorted initially then you could set aaSorting to be [[1,'asc']], for example.

    Regards,
    Allan
  • MonicoMonico Posts: 6Questions: 0Answers: 0
    Great !

    I didn't think an empty array could work.

    Thanks a lot and congratulations for your script.
This discussion has been closed.