How do I set the column to sort on first load?

How do I set the column to sort on first load?

soroushhakamisoroushhakami Posts: 10Questions: 0Answers: 0
edited October 2011 in General
Say that I want my datatable to sort on the second column, 'lastname' in descending order by default the first time the table is loaded. How can i achieve this?

I've already tried this with no success:

[code]"aoColumns": [
{ "mDataProp": "firstname"},
{ "mDataProp": "lastname", "asSorting": [ "desc" ]},
{ "mDataProp": "unit_name" },
{ "mDataProp": "employment_title" },[/code]

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    http://www.datatables.net/ref#aaSorting

    [code]
    "aaSorting": [[1, "desc"]]
    [/code]
  • soroushhakamisoroushhakami Posts: 10Questions: 0Answers: 0
    A little late but thanks!
This discussion has been closed.