Skip to content
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

[data grid] Column Visibility - Reset Button Confuses Users #16072

Open
bbosreferrals opened this issue Jan 3, 2025 · 7 comments
Open

[data grid] Column Visibility - Reset Button Confuses Users #16072

bbosreferrals opened this issue Jan 3, 2025 · 7 comments
Labels
breaking change component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature feature: Column visibility

Comments

@bbosreferrals
Copy link

bbosreferrals commented Jan 3, 2025

Summary

The reset button in the column selection pane confuses all users we've tested the function with. Everyone expects it to reset the columns back to the default ones. But it becomes disabled after you select columns and people are confused why it only works when you're actively selecting columns.

Here's short video showing the issue: https://vimeo.com/1043746747/2e32b38b79?share=copy

Does MUI have any advice or future functionality to address this?

Examples

https://mui.com/x/react-data-grid/column-visibility/#column-visibility-panel

Motivation

Allow our customers to easily revert back to our default columns.

Search keywords: Column Visibility, column Reset Button

@bbosreferrals bbosreferrals added new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 3, 2025
@arminmeh arminmeh added component: data grid This is the name of the generic UI component, not the React module! feature: Column visibility labels Jan 6, 2025
@arminmeh
Copy link
Contributor

arminmeh commented Jan 6, 2025

@bbosreferrals thanks for the suggestion.
I agree that the label could be misleading. @KenanYusuf do you think "Undo" or "Revert" would be more suitable here?

@bbosreferrals to just change the default label, you can use Localization feature and override columnsManagementReset translation key

To change the button's behavior and/or to add more buttons, you will have to pass a custom component to the columnsPanel slot. You can see a customized panel in this demo

It is not perfect because you have to override the whole panel, but it will solve your problem. To make this experience better we are actually working on a new set of composable components. This will make it easier to make the customizations like yours. You can follow the linked PR to get the updates.

Hope that this helps.

@arminmeh arminmeh added status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 6, 2025
@arminmeh arminmeh changed the title Column Visibility - Reset Button Confuses Users [data grid] Column Visibility - Reset Button Confuses Users Jan 6, 2025
@KenanYusuf
Copy link
Member

I think "Undo" would be clearer.

It is confusing - it would make more sense to reset to the initial columns state IMO. Is there a reason we only reset the changes that were made whilst the columns panel is open? @mui/xgrid

@cherniavskii
Copy link
Member

I agree it's confusing and the Reset button should behave the same regardless of whether the panel was closed before reset 👍🏻
Now, what's the initial column visibility state? For the uncontrolled model, it's initialState.columns.columnVisibilityModel.
How about the controlled model? Should we store the first controlled model value and use it on reset?

@KenanYusuf
Copy link
Member

How about the controlled model? Should we store the first controlled model value and use it on reset?

I think so. From an end user perspective, the first controlled model is the initial state of column visibility.

@arminmeh
Copy link
Contributor

arminmeh commented Jan 6, 2025

I have tracked down the requirement for the button to #5700

Other features to consider
Add a "Reset state" button.
From customer feedback: "The ability to reset the table columns view to its initial state would be very useful. This would allow users to revert the columns to their default state after users have made changes using the column selector."

For me it looks like that this is aligned with the motivation from this issue, so we should update the button action to actually reset.

Now, since we already have the logic for "Undo", should we have both actions in the panel or that might be too much?

@cherniavskii
Copy link
Member

Now, since we already have the logic for "Undo", should we have both actions in the panel or that might be too much?

No, I think the new Reset behavior should replace the old one, otherwise it would be confusing.

@cherniavskii cherniavskii added breaking change enhancement This is not a bug, nor a new feature and removed new feature New feature or request labels Jan 6, 2025
@arminmeh arminmeh removed the status: waiting for author Issue with insufficient information label Jan 6, 2025
@arminmeh
Copy link
Contributor

arminmeh commented Jan 6, 2025

@bbosreferrals as a temporary workaround you can use my earlier suggestion.
Once this issue is closed, the button should work as you expect.

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Jan 7, 2025
@arminmeh arminmeh moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change component: data grid This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature feature: Column visibility
Projects
Status: 🔖 Ready
Development

No branches or pull requests

4 participants