OrderData easy way to sort asc or desc

OrderData easy way to sort asc or desc

MausinoMausino Posts: 61Questions: 19Answers: 0

Hi, i see docs https://datatables.net/reference/option/columns.orderData

I found the answer from year 2018 https://datatables.net/forums/discussion/53349

but my question is:

Is some easy way to achieve in columns or columnsDef this:

$('#example').dataTable( {
  "columnDefs": [
    { "orderData": [ [0, "asc"], [1, "desc" ],    "targets": 0 },
    { "orderData": 0,           "targets": 1 },
    { "orderData": [ 2, [3, "desc"], 4 ], "targets": 2 }
  ]
} );

I know that is not working, but this is only for ispiration.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    No - at this time the two columns will sort in the same direction I'm afraid. There is no way around that with the built in sort listener. Sorry.

    Allan

Sign In or Register to comment.