How to set a column to be sorted on page load dynamically?

How to set a column to be sorted on page load dynamically?

devXXXdevXXX Posts: 1Questions: 0Answers: 0
edited September 2011 in General
Iam using Asp mvc. Ihave this table,which is a datatables,

in my page, columns of the table sometimes appear or not, depending on the users authotrization.
e.g i have this table with checkbox(it appears dynamically and is on the left-most column), that i want to be not sortable.
i also wanted to sort the first column in the left on default.
So whether, checkbox appears or not, i want the first non-check box column to be sortable.
Is this possible?.

thanks in advance.

Replies

  • allanallan Posts: 63,531Questions: 1Answers: 10,475 Site admin
    It sounds like what you need to do is have a little bit of Javascript which figures out which column is the one you want to sort on, and then plug that value into aaSorting ( http://datatables.net/ref#aaSorting ).

    Allan
This discussion has been closed.