Multi-order

Multi-order

bobbyredbobbyred Posts: 1Questions: 0Answers: 0
edited April 2016 in Free community support

Hello to all,
I'm trying to sort a table with DataTable with a multi order quite complex.
I have to order with the columns 3, 2 and 1 but the last in descending order.

The normal sort I did

$('#Tab_30').DataTable( {
    ordering: true,
    columnDefs: [ {
        targets: [ 3 ],
        orderData: [ 3, 2, 1 ]
    }, { 
        targets: [ 7 ],
        "orderable": false
    } ],
    "order": [[ 3, "desc" ]]
} );

But I can not set the descending order in the last column (1)

Thanks for your help

Replies

  • allanallan Posts: 61,985Questions: 1Answers: 10,162 Site admin

    Unfortunately, at the moment the order direction when using orderData can only be applied in a single direction (i.e. common to all of the columns specified). That is certainly a limitation that I plan to address in future.

    One thing I haven't sorted out with the interaction yet though is - presumably the direction should be inverted. So for example when you sort column index 3 ascending you want 3-asc, 2-asc, 1-desc and then when descending you want 3-desc, 2-desc, 1-asc?

    So it isn't so much that we need a way to specify the direction, but a way to invert the host column's direction?

    Allan

This discussion has been closed.