How to sort the first column desc by default
How to sort the first column desc by default
I want to sort the first(ID) column desc by default. Here is what i tried:
$(document).ready(function() {
$("#patientStoryLst").dataTable({
"sPaginationType" : "full_numbers",
"iDisplayLength " : 5,
"bJQueryUI" : true,
"sDom" : '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"aoColumns": [ { "asSorting": [ "desc", "asc" ] },
{ "bSortable": false },
null, null,null,null,null, null,null,null,null,null ]
});
});
but the first column is not sorted desc order by default.
can anybody help me?
$(document).ready(function() {
$("#patientStoryLst").dataTable({
"sPaginationType" : "full_numbers",
"iDisplayLength " : 5,
"bJQueryUI" : true,
"sDom" : '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"aoColumns": [ { "asSorting": [ "desc", "asc" ] },
{ "bSortable": false },
null, null,null,null,null, null,null,null,null,null ]
});
});
but the first column is not sorted desc order by default.
can anybody help me?
This discussion has been closed.
Replies
If you would like to sort the on the first column in descending order, you could apply the following:
[code]
$(document).ready(function() {
$("#patientStoryLst").dataTable({
"sPaginationType" : "full_numbers",
"iDisplayLength " : 5,
"bJQueryUI" : true,
"sDom" : '<"top"iflp<"clear">>rt<"bottom"iflp<"clear">>',
"aoColumns": [ {"bSortable": false }, null, null, null, null, null, null, null, null, null,null ],
"aaSorting": [ [0,'desc'] ]
});
});
[/code]
The relevant section added here being the aaSorting options.
Cheers,
Luke