DataTables Set Default sorting column and set unsortable columns

As per the table sorting docs you can do that using the order option:

$('.table-asc0').dataTable({
  order: [[0, 'asc']]
})

The 0 indicates to sort on the first column, while asc to do it in ascending order. You can chose any other column and use desc too.


For DataTables versions prior to 1.10 you should use aaSorting instead

$('.table-asc0').dataTable({
  aaSorting: [[0, 'asc']]
})

To order descending on the first column:

$('.table-asc1').dataTable({
  aaSorting: [[1, 'desc']]
})

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)