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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] singleSelect cell stays in edit mode after selection #12617

Open
sydneyjodon-wk opened this issue Mar 29, 2024 · 1 comment
Open
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Editing Related to the data grid Editing feature support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ support: question Community support but can be turned into an improvement

Comments

@sydneyjodon-wk
Copy link

sydneyjodon-wk commented Mar 29, 2024

The problem in depth

Hello! 馃憢

I have some questions about why the singleSelect cell type does not exit edit mode when the user selects an option:

See the gif below (sandbox demo):

single-select-behavior

  • Current default behavior (on the left): The cell stays in edit mode after an option is selected so then you have to click out of the cell to get it to leave edit mode.

  • Desired behavior (on the right): The cell exits edit mode after an option is selected.

It seems like the only way to get the desired behavior is to build the edit cell yourself using renderEditCell and call apiRef.current.stopCellEditMode.

I have a couple questions:

  • Why does the default behavior not exit edit mode when a selection is made? It seems like it would be nice to prevent the additional click. (also I found this functionality in the columns in the docs that use renderEditCell - ex see the status column here)
  • Is the desired behavior something that could be built into the singleSelect column type? Or is there some other way to achieve this behavior without having to re-build the Select in renderEditCell?

Your environment

Here is a sandbox link: https://stackblitz.com/edit/react-cqqred?file=Demo.tsx

Thank you!

Search keywords: singleSelect, renderEditCell, edit mode
Order ID: 82849

@sydneyjodon-wk sydneyjodon-wk added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Mar 29, 2024
@zannager zannager added support: question Community support but can be turned into an improvement component: data grid This is the name of the generic UI component, not the React module! support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ labels Apr 1, 2024
@michelengelen
Copy link
Member

@sydneyjodon-wk thanks for raising this issue.
I will add this to our board for the team to discuss if this is intended behaviour or if wwe could implement the dropdown closing when a selection is done.

For now your proposed way (custom renderEditCell)is the only possible one, afaik.

@michelengelen michelengelen changed the title [question] [data grid] singleSelect cell stays in edit mode after selection [data grid] singleSelect cell stays in edit mode after selection Apr 2, 2024
@michelengelen michelengelen added feature: Editing Related to the data grid Editing feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! feature: Editing Related to the data grid Editing feature support: commercial Support request from paid users support: premium standard Support request from a Premium standard plan user. https://mui.com/legal/technical-support-sla/ support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants