Sort all columns simultaneously
Sort all columns simultaneously
islamelshobokshy
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:
This discussion has been closed.
Answers
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
Not sure what happened there, that code isn't working. Try this one instead: http://live.datatables.net/qelemipo/2/edit
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
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.
Doesn't work still
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.
Great it works!! Thanks!!