datatables sorting order code example
Example 1: datatables sorting order
$('#table').DataTable( {
order: [[ 3, "desc" ]]
} );
$('#example').DataTable( {
order: [[ 3, 'desc' ], [ 0, 'asc' ]]
} );
aaSorting: [[3, "desc"]]
Example 2: sort datatable c#
Datatable.DefaultView.Sort = "Preferance ASC";
Example 3: sorting number with coma datatable
<script type="text/javascript" src="jquery.dataTables.js"></script>
<script type="text/javascript" src="dataTables.numericComma.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#example').dataTable( {
"columnDefs": [
{ "type": "numeric-comma", targets: 3 }
]
} );
} );
</script>