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.
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/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.