I have a visualforce page that I want to sort its columns by a datetime field which I do in the SOQL query via the controller using the ORDER by myDateTime__c DESC. However I also need to use javascript/jquery to make the other columns in the table sortable in case the user wishes to do so. Problem is when I disable the javascript sort, results get ordered by the dateTime field as desired but other columns are not sortable. when I enable it, then results lose their order but other columns are then sortable. Anybody know what I am doing wrong based on the code snippet below?
function bindRowEvents() {
var $comTable = $j("#com-table")
cDataTable = $comTable.dataTable( {
"bDestroy" : true,
"bSort": true,
"sScrollY": "400px",
"bAutoWidth": true,
"sProcessing": "Processing...",
"aoColumnDefs": [
//{ "bSortable": true,"aTargets":[] },
//{ "aDataSort": [ 0 ], "aTargets": [ 0 ] }
{ "asSorting": [ "desc" ], "aTargets": [ 0 ] }
],
"bPaginate": false,
"iDisplayLength": 4,
"bLengthChange": false,
"bFilter":false,
"oLanguage": {
"sEmptyTable": "No matching Organizations found."
}
});