0

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.

1 Answer 1

1

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/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.