multi-column sort direction using v 1.10.0

multi-column sort direction using v 1.10.0

sebmoisebmoi Posts: 3Questions: 1Answers: 0

Hi everyone !

Using this example http://jsfiddle.net/b2fLye17/17/

When we click the age column , it sorts by age then by salary both in the same direction (age->'asc' & salary->'asc') or ( age->'desc' & salary->'desc').

Is there a way to set the sorting direction so it would be (age column sorted 'asc' (age sorted 'asc' & salary sorted 'desc')) or ((age column sorted 'desc' (age sorted 'desc' & salary sorted 'asc')) ?

The wanted result would invert Garret and Tiger in the example because we first sort by age and then(when same age) by salary but in "reverse"

Thanks !

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin

    Sounds like it is the columns.orderSequence option you want?

    Allan

  • sebmoisebmoi Posts: 3Questions: 1Answers: 0
    edited December 2014

    Thanks for your quick answer.

    I've checked orderSequence and I dont think its what I'm looking for.

    Take a look at this example http://jsfiddle.net/b2fLye17/22/

    It describes what I'm looking for. Maybe I can do it with orderSequence or there is something else that can help me.

  • allanallan Posts: 63,691Questions: 1Answers: 10,500 Site admin
    Answer ✓

    Ah - I see what you are looking for. Thanks for the example.

    Currently no, I'm sorry to say there is no way of doing that with the initialisation options in DataTables. You could remove DataTables own sort listener and then attach your own using the order() method to order the table as you need.

    Sorry I don't have better news.

    Allan

  • sebmoisebmoi Posts: 3Questions: 1Answers: 0

    Ok thaks for your reply !

This discussion has been closed.