Reputation: 143
Here's an example datatable:
currently am using this JS to initialize the table:
$(document).ready(function() {
$("#example").dataTable({
"sDom": "<'row'<'col-lg-11'i><'col-lg-1'>r>t<'row'<'col-lg-6'l><'col-lg-6'p>
});
});
I would like to change the default sort order from ascending to descending, how would I go about doing so? I have tried:
"order": [[ 3, "desc" ]]
however, that breaks the tables sorting buttons.
Upvotes: 0
Views: 6280
Reputation: 30975
This code seems to work :
JS:
$(document).ready(function() {
$("#example").dataTable({
"sDom": "<'row'<'col-lg-11'i><'col-lg-1'>r>t<'row'<'col-lg-6'l><'col-lg-6'p>>",
"order":[[3, 'desc']]
});
});
Fiddle : http://jsfiddle.net/xF8hZ/11/
Upvotes: 1