Datatables - Default Sort

Asked

Viewed 439 times

1

How do I have a table already sorted by a particular column in Datatable ?

1 answer

1


You can do it here:

$(document).ready(function() {
    $('#example').DataTable( {
        order: [[ 3, 'desc' ]]
    } );
} );

where order: [[ 3, 'desc' ]] 3 means the number of your column and down means that it will sort from the highest to the highest or from Z to A, the columns are numbered from 0 to the last, from left to right.

https://datatables.net/examples/basic_init/table_sorting.html

Browser other questions tagged

You are not signed in. Login or sign up in order to post.