Default sorting with particular column

Default sorting with particular column

markjomarkjo Posts: 66Questions: 0Answers: 0
edited April 2013 in General
I have such snippet, this works well:
[code]aoColumnDefsType = [
{ "sType":"title-numeric", "aTargets":[ 3 ] },
{ "sType":"title-numeric", "aTargets":[ 7 ] },
{ "bSortable":false, "aTargets":[ 0 ] },
{ "bSortable":false, "aTargets":[ 8 ] },
{ "bSortable":false, "aTargets":[ 9 ] },
{ "sClass":"center", "aTargets":[ 2, 3, 4, 5, 6, 7 ] }
];[/code]
[code]"aoColumnDefs":aoColumnDefsType[/code]

When starting table, I want my datatable sorted by 6th column descending autmatically.
I tried this but didn't work. I added following line to "aoColumnDefsType"
Shouldn't I use asSorting for this ?
[code] { "asSorting": [ "desc"], "aTargets": [ 6 ] }[/code]

Replies

  • allanallan Posts: 63,516Questions: 1Answers: 10,473 Site admin
    Use aaSorting . That is the first sort that is applied to the table.

    Allan
  • markjomarkjo Posts: 66Questions: 0Answers: 0
    Thank you that worked well.
This discussion has been closed.