Sign up ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free.

Here's an example datatable:

http://jsfiddle.net/xF8hZ/10/

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.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

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/

share|improve this answer
    
I.... forgot a comma. Thanks. – RoflcopterV RoflcopterV Sep 19 '14 at 15:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.