Skip to content

[DataGridPro] Allow multi sorting without modifier key #17925

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

Merged
merged 7 commits into from
May 22, 2025

Conversation

cherniavskii
Copy link
Member

Closes #14563

@cherniavskii cherniavskii added scope: data grid Changes or issues related to the data grid product plan: Pro Impact at least one Pro user feature: Sorting Related to the data grid Sorting feature type: enhancement This is not a bug, nor a new feature labels May 20, 2025
@mui-bot
Copy link

mui-bot commented May 20, 2025

Deploy preview: https://deploy-preview-17925--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against 6aa43f6

* If `true`, the multi-sorting is applied on column header click without modifier key.
* @default false
*/
multiSortingWithoutModifier: PropTypes.bool,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of the prop holds the implementation detail.
Maybe it can be just multiSorting or something like keepSort

Copy link
Member

@flaviendelangle flaviendelangle May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have the disableMultipleColumnsSorting that enables or not the whole multi-sorting feature.
I fear that multiSorting would create confusion between the two.
Maybe we could combine both at some point (next major though).

And if we keep 2 distincts props, the main goal for me would be to make the distinction between the two crystal clear

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name of the prop holds the implementation detail.

TBH, this is intentional to make it clear for devs that multi sorting will work without the modifier key 😅

Maybe it can be just multiSorting or something like keepSort

But multisorting is enabled by default, it's just that the default behavior requires users to use the modifier key.
Hence the naming.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe then multiSortingOnClick to say when it is working instead of what do you not need 😁

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could combine both at some point (next major though).

I prefer to avoid another breaking change for such a small feature.
I think 2 distinct props are OK.

Initially, I called it multipleColumnsSortingWithoutModifier, but I thought it's too long 😅
How about this?

multiSortingMode: 'withModifierKey' | 'withoutModifierKey'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiSortingMode: 'always' | 'withModifierKey'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this looks good to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiSortingMode looks good to me

Copy link
Member

@MBilalShafi MBilalShafi May 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the naming be consistent though to link them together: disableMultipleColumnsSorting and multipleColumnsSortingMode?
And if we are convinced that it's too verbose and "multiSorting" is enough to convey the intention, they could become disableMultiSorting and multiSortingMode in the next major.

Sidenote: I think it also makes sense to make "always" the default behavior in the next major.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the naming be consistent though to link them together: disableMultipleColumnsSorting and multipleColumnsSortingMode?

Agree with this
I see that we also have disableMultipleColumnsFiltering

@cherniavskii cherniavskii marked this pull request as ready for review May 21, 2025 20:41
@cherniavskii cherniavskii requested a review from arminmeh May 21, 2025 20:41
@cherniavskii cherniavskii merged commit 4db33e0 into mui:master May 22, 2025
23 checks passed
@cherniavskii cherniavskii deleted the MultiSortingWithoutModifier branch May 22, 2025 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: Sorting Related to the data grid Sorting feature plan: Pro Impact at least one Pro user scope: data grid Changes or issues related to the data grid product type: enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Multi-sorting discoverability issues
5 participants