views:

34

answers:

1

I am using DataTables to display some data and it works great but I want to customize it slightly and not sure how.

What I want to do is when a user clicks on a column heading to sort that column I want it to initially order descendingly rather than ascendingly. Is there any way to do this?

+1  A: 

Have a look at this: DataTables sorting direction control example

You can do something like:

$(document).ready(function() {
    $('#example').dataTable( {
        "aoColumns": [
            { "asSorting": [ "desc", "asc" ] }, //first sort desc, then asc
        ]
    } );
} );
SteD
Thanks works great! Do you know any way that when sorting you can have blank/ empty fields appear last rather than first?
John