order by datatable code example
Example 1: datatables sorting order
$('#table').DataTable( {
order: [[ 3, "desc" ]]
} );
$('#example').DataTable( {
order: [[ 3, 'desc' ], [ 0, 'asc' ]]
} );
aaSorting: [[3, "desc"]]
Example 2: datatable desc active
$('#exemple').DataTable({
"order": [[ 3, "desc" ]],
"columnDefs" : [{"targets":3, "type":"date-eu"}],
});
Example 3: datatable get order column
var table = $('#example').DataTable();
var order = table.order();
alert( 'Table is ordered by column: ' + order[0][0] + ', direction:' + order[0][1]);
var title = table.column(order[0][0]).header();
alert( 'Ordering column title: ' + $(title).html() );