-
Notifications
You must be signed in to change notification settings - Fork 83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maintain sort property order when changing sort direction #1281
Comments
This also is intended behavior and not a bug. I took a look at some of the other data grids out there and seems that some follow the same behavior (the last sorted column gets the first priority in sorting) and some do the opposite. Changing this now in vaadin-grid would be a breaking change, UX-wise. What we could do is to offer some more control over what happens on column sort so it would be easier to apply individual preferences for the behavior. But that would also be an enhancement, not a bugfix. Some adjustments can be made with the current API already:
|
I will admit, I am VERY surprised this is "intended behaviour" because it's confusing to just about everybody I show this to.
Of course they do, they quite simply have no other choice if they want to use "plain Vaadin".
Yes, but maintaining the sort property order when you change the sort direction requires either overriding the sort property selection logic in the vaadin component or slapping additional bookkeeping on top of it to correct vaadin's selection before we pass it on. Because we can no longer make assumptions about the property order in the backend. |
I meant data grids from vendors other than Vaadin
Yes, additional bookkeeping would most likely be required. A dedicated API for the purpose would be ideal. |
@tomivirkki could you please post links to videos or pages from those vendors other than Vaadin, so that we can compare? |
To me it looks like the proper way of fixing this would be adding new property e.g. web-components/packages/grid/src/vaadin-grid-sort-mixin.js Lines 83 to 85 in b4dec66
if (this.reverseSortOrder) {
this._sorters.push(sorter);
} else {
this._sorters.unshift(sorter);
} Then we would also need to update sorters when |
SETUP
Take any
GridPro
and make it multi-sort.Experienced under:
Vaadin
14.2.3
Chrome
84.0.4147.89 (Official Build) (64-bit)
Ubuntu
20.04.1 LTS
IS
Whatever sort property you activate last is considered the one that should be sorted by first.
(Weird behaviour, imo, but apparently a feature since vaadin/vaadin-grid#1624 was not labelled a bug.)
If you have multiple sort properties selected, and you change the sort direction of one, that will count as being "activated last" and will therefore become the new first sort property.
SHOULD
Changing sort direction on an already active sort property should maintain the existing sort order.
The text was updated successfully, but these errors were encountered: