How to replace deprecated aaSorting code to restrict column ordering direction?

How to replace deprecated aaSorting code to restrict column ordering direction?

Nick HopeNick Hope Posts: 48Questions: 12Answers: 1
edited November 2020 in Free community support

Link to test case:
http://live.datatables.net/mumosiso/2/edit

Description of problem:
As seen in the above example, I am able to restrict the direction in which columns can be ordered according to a class in the column header. But it's using aaSorting, which is legacy code for v1.9.

$(document).ready( function () {
  var table = $('#example').DataTable( {
    order: [ 2, 'desc' ],
    columnDefs:[
      {
        asSorting: ['desc'],
        targets: ['desc_only']
      },
      {
        asSorting: ['asc'],
        targets: ['asc_only']
      }
    ]
  } );
} );

Is there a way to do the same using non-deprecated code for v1.10? I've tried using order but can't get it working.

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.