AJAX sort descending on load
AJAX sort descending on load
dmitra
Posts: 6Questions: 0Answers: 0
Hi there.
I posted this in general discussion by accident and I got no help. So I'm reposting here - hopefully that's okay. Here's my original post issue.
____________________________________
I am having an issue with this sorting the following. It loads everything fine and sorts by the correct column (the 1st), however, it's ascending. I would like to have it sort on load descending but am not sure how to do so. Any advice would be greatly appreciated. Thanks
Derrick
$('#myTable').dataTable({
"bProcessing": true,
"bAutoWidth": false,
"bJQueryUI": true,
"sAjaxSource": "/path/to/service/",
"aoColumns": [
{ "mDataProp": "LabNumber", "sType": "string"},
{ "mDataProp": "DateClosed" },
{ "mDataProp": "ConsumerName" },
{ "mDataProp": "Status" },
]
});
I posted this in general discussion by accident and I got no help. So I'm reposting here - hopefully that's okay. Here's my original post issue.
____________________________________
I am having an issue with this sorting the following. It loads everything fine and sorts by the correct column (the 1st), however, it's ascending. I would like to have it sort on load descending but am not sure how to do so. Any advice would be greatly appreciated. Thanks
Derrick
$('#myTable').dataTable({
"bProcessing": true,
"bAutoWidth": false,
"bJQueryUI": true,
"sAjaxSource": "/path/to/service/",
"aoColumns": [
{ "mDataProp": "LabNumber", "sType": "string"},
{ "mDataProp": "DateClosed" },
{ "mDataProp": "ConsumerName" },
{ "mDataProp": "Status" },
]
});
This discussion has been closed.
Replies
Allan
Not sure where to place this parameter as I've tried the following but the code does not load the table - I just see "loading" and it just hangs. Any insight?
$('#myTable').dataTable({
"bProcessing": true,
"bAutoWidth": false,
"bJQueryUI": true,
"aaSorting": [[0,'desc']],
"sAjaxSource": "/path/to/service/",
"aoColumns": [
{ "mDataProp": "LabNumber", "sType": "string"},
{ "mDataProp": "DateClosed" },
{ "mDataProp": "ConsumerName" },
{ "mDataProp": "Status" },
]
});
The code you posted looks like what I would expect for what you want (minus the trailing comma in the aoColumns array which will be causing IE to error out).
Allan
What am I looking for in Firebug specifically?