Multi column sort for tables


A table can be made sortable with setColumnReorderingAllowed(). I currently supported multiple column order? If not, I think it’s not complicated. The container.sortable interface supports it.

Aniceto Perez

Currently table only support sorting by one column, but it might be possible to extend sorting to multiple columns. One of the main problem (and also the reason why only one column sorting is supported) is how to show/control sorting order in UI?

Hi Joonas

I think the simplest way is to add two features:

  1. each column can be in any of three states: none, up, down, which means don’t care, ASC and DESC
  2. the sort order is always the column order. If you want to change the colum order list, change the column order

With respect with collapsed columns there are two possibilities:

  • just ignore them
  • take them into account whether collapsed or not

A second more sophisticated way is:

  • work as now
  • if a mod key is pressed, like shift, change to second mode

A third mos sophisticated way is to draw near the arrow an increasing number which says the column ordering order. If no mod key is pressed, all selections will go with a ‘1’, or no number. If the mod key is pressed, subsequent column header clicks will select the second, third, etc. If a column is cicled from up to down, it will keep it’s position, if it cicles to none, the columns with greater numbers will decrease it’s numbers. This way, the column rendering order hos not to be the same as the column ordering order.


Sorry for not answering to this. The idea is still valid - created a ticket for it