[ ] bug
[X] feature request
[ ] enhancement
When any column sort pressed and there is already column with sort - it shouldn't delete previous sort.
Sort property of state should be array of sorted columns.
This feature request blocked by https://github.com/vmware/clarity/issues/1468
Triple state sort required in order to remove sort from irrelevant columns.
Currently sort works only by one column.
Whet another column sort clicked - previous column sort disappears.
@ph55
What is the use case for multi-column sort?
@mathisscott
There is many.
For example:
etc.
Thanks for the clarification, @ph55.
@reddolan and @youdz: what are your thoughts on this use case?
@reddolan
Does this seem like something we would want the datagrid to do?
This sounds like two separate requests
Is that correct @ph55?
@reddolan correct
@ph55 would you mind updating this issue/request to have one of the two requests in it and file another issue for the second remaining request? This will help us with planning and completing requests.
@reddolan
here you go
We're moving this into our backlog of planned work along with #1468. It's not a near-term priority for us at this time as it will introduce a breaking change to datagrid.
For the design, I recommend up arrow, down arrow, and then remove arrow as the three states (per existing datagrid sort design)
The 'remove sort' function suggests that sort becomes persistent until dismissed. The normal interaction design is for any sort function to dismiss any previous sort function (sorting column A removes the sort on column B). Assuming single sort is the more common use case, and multi-sort is the special case, requiring the user to clear any enabled sort when making a new sort is not ideal.
Adding pin-sort (or lock) would would allow a second column to be sorted without clearing the sort on the initial one while retaining the standard behavior for single sort. Investigation is needed to determine the reasonable requirements and permutations of both approaches and decide on the preferred approach.
I'd like to add that data driven applications generally use shift+click on a header to add a column to the sorted columns.
See for example the example grids on http://ui-grid.info/. Click on a column header, shift+click on another, you can see the multi-column sort in action and the visual feedback showing which column is sorted first.


A use case for this is a product table, we want the user to be able to sort by category, and speed, and price, kind of like https://www.ec2instances.info
Multi column sort is kinda expected from rich datatables. Is the ability to support multiple column sorting still planned?
This is still on our radar but is not currently prioritized in the near future. Please share more use cases, but this is also likely to be addressed by #1632
The documentation for datagrids states that they are used
for organizing large volumes of data
When the amount of data are large (spanning multiple paginated pages), the ability to sort on multiple columns becomes very important. As a simple example, say within a table of "jobsites", one column is titled "Customer" and another is titled "Active issues". Being able to sort by multiple columns allows each customer's sites to be grouped together (first sorting priority) and within each customer is their jobsites sorted by active issues (second sort priority).
Another use case would be the same "jobsites" table where "active issues" is the primary sort column so that any jobsite with an active issue is guaranteed to be at the top of the table. If a small percentage of the jobsites have an active issue, having a second sort column allows the rest of the table (the majority) to be organized.
I don't think that these are special use cases. For instance, any RDBMS application that I have ever used provides this capability. The various SQL dialects include this capability as well (... ORDER BY Country, City), so I think it is a requirement for any tool that is designed for interacting with large datasets.
This is similar to other requests that allow triple state sorting. #1468
The feature request here has been captured into our list and we鈥檙e going to take it into consideration as we develop Clarity Core capabilities. In an effort to clean up our backlog and focus our attention, I鈥檓 going to close this as captured in our feature requests. Please follow our development and releases to see when we release relevant components to make this possible. Future feature requests can be made in our GitHub Discussions.
Most helpful comment
The documentation for datagrids states that they are used
When the amount of data are large (spanning multiple paginated pages), the ability to sort on multiple columns becomes very important. As a simple example, say within a table of "jobsites", one column is titled "Customer" and another is titled "Active issues". Being able to sort by multiple columns allows each customer's sites to be grouped together (first sorting priority) and within each customer is their jobsites sorted by active issues (second sort priority).
Another use case would be the same "jobsites" table where "active issues" is the primary sort column so that any jobsite with an active issue is guaranteed to be at the top of the table. If a small percentage of the jobsites have an active issue, having a second sort column allows the rest of the table (the majority) to be organized.
I don't think that these are special use cases. For instance, any RDBMS application that I have ever used provides this capability. The various SQL dialects include this capability as well (
... ORDER BY Country, City), so I think it is a requirement for any tool that is designed for interacting with large datasets.