Sort all columns simultaneously

Sort all columns simultaneously

islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

I want to be able to sort all columns at the same time.

If I sort the first column, it gets sorted alone.
If I sort the second column, it sorts the first column asc first, and then sorts itself asc depending on the previous column.
If I sort the third column, it sorts the first column asc, the second column asc depending on the first one, and itself (the third column) asc depending on the second column.

How could I do that ?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    Hi @islamelshobokshy ,

    Take a look at the example here - it's not pretty, but it's doing what you want.

    Hope that does the trick,

    Cheers,

    Colin

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Not sure what happened there, that code isn't working. Try this one instead: http://live.datatables.net/qelemipo/2/edit

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1
    edited April 2018

    It doesn't do what I want it to do when I looked into it tbh. When I order second column ASC, the first one doesn't stay ASC, so the second column isn't being ordered ASC depending on the first one :( I appear to be needing to click on shift before ordering them for it to work. Can it be done automatically without clicking on shift? @colin

  • colincolin Posts: 15,237Questions: 1Answers: 2,598

    Hi, did you reload? I just noticed myself something was wrong on my last comment. Take a look at the link in my previous message. Sorry about the confusion.

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    Doesn't work still :(

  • colincolin Posts: 15,237Questions: 1Answers: 2,598
    Answer ✓

    With that second example, http://live.datatables.net/qelemipo/2/edit, for me, whenever I click on a column to order, all other columns to the left of that one are also ordered 'asc' - the table doesn't change due to the dataset being used, but if you look at the order icons at the top of the columns you'll see the order.

  • islamelshobokshyislamelshobokshy Posts: 99Questions: 20Answers: 1

    Great it works!! Thanks!!

This discussion has been closed.