I am trying to give a the second column in our data table sorting from biggest to smallest/ I have tried the following without success.
$(".one-table").dataTable({
"bRetrieve": false,
"bFilter": false,
"iDisplayLength":4,
"bLengthChange": false,
"bJQueryUI": true,
"bAutoWidth":false,
"aoColumns": [
{ "asSorting": [ "asc" ], "aTargets": [ 2 ]},
{ "asSorting": [ "desc" ], "aTargets": [ 1 ]} ]
});
Whilst this works for setting the default sorting direction, it does not allow us to sort the default column. I have also tried iDataSort
Datatables API says to use $(document).ready(function() {
var oTable = $('#example').dataTable();
// Sort immediately with columns 0 and 1
oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );
} );
But this just creates errors
The next version I tried
> var clTable;
> clTable = $(".one-table").dataTable({ "bRetrieve": false,
> "bFilter": false,
> "iDisplayLength":4,
> "bLengthChange": false,
> "bJQueryUI": true
>
>
> });
> clTable.fnSort( [ [1,'asc'] ] );