"orderData": [a, [b, "asc"], [c, "desc"], ...

"orderData": [a, [b, "asc"], [c, "desc"], ...

stepsusstepsus Posts: 1Questions: 1Answers: 0

Question based on https://datatables.net/forums/discussion/21270/orderdata-a-b-asc-c-desc

I have a table with 2 columns. By default it sorted by first column by descending. If I want to sort it by another column, it should be sorted by this column in given direction + by first column by descending. How to do this?

Now I have:
'columns': [
{
'data': 'orderDate'
},
{
'data': 'orderTitle',
'orderData': [1, 0]
}
]

But I think should be smt like this:
'columns': [
{
'data': 'orderDate'
},
{
'data': 'orderTitle',
'orderData': [1, [0, desc]]
}
]

Answers

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    There is no option for that yet I'm afraid. DataTables does not yet support this ability.

    Allan

  • epep Posts: 24Questions: 6Answers: 0

    Hi Alan,

    is there any workaround for this, e.g. based on PHP? I also need a functionality like this.

    Thanks,
    Eberhard

  • allanallan Posts: 63,889Questions: 1Answers: 10,530 Site admin

    Sorry no. It is not a feature that is supported by DataTables at this time and I don't think there is a workaround. The only option would be to implement it in DataTables.

    Allan

This discussion has been closed.