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] Custom cell with edit modal which does not close unexpectedly #11018

Closed
Kohei909Otsuka opened this issue Nov 13, 2023 · 2 comments
Closed
Labels
component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information support: commercial Support request from paid users

Comments

@Kohei909Otsuka
Copy link

Kohei909Otsuka commented Nov 13, 2023

The problem in depth 🔍

I'm trying to write custom edit cell for specific use case , something like below.

https://mui.com/x/react-data-grid/custom-columns/#date-pickers
https://codesandbox.io/s/w45yyn?file=/src/Demo.tsx

Then problem is , whenever I hit enter key or tab key, grid takes the event as "stop edit mode", and modal closes.

全画面_2023_11_13_12_37

Is there any good way to solve this?
I need custom cell with edit modal, which dose not close by mui x grid default event listener

Your environment 🌎

System:
OS: macOS 12.4
Binaries:
Node: 16.8.0 - ~/.nvm/versions/node/v16.8.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.8.0/bin/yarn
npm: 7.21.0 - ~/.nvm/versions/node/v16.8.0/bin/npm
Browsers:
Chrome: 119.0.6045.123
Edge: Not Found
Safari: 15.5
npmPackages:
@emotion/react: ^11.7.1 => 11.11.1
@emotion/styled: ^11.10.4 => 11.10.4
@mui/base: 5.0.0-beta.6
@mui/core-downloads-tracker: 5.10.13
@mui/icons-material: ^5.10.9 => 5.10.9
@mui/lab: ^5.0.0-alpha.107 => 5.0.0-alpha.107
@mui/material: ^5.10.13 => 5.10.13
@mui/system: 5.10.16
@mui/x-data-grid: ^6.9.1 => 6.9.1
@mui/x-data-grid-premium: ^6.16.0 => 6.17.0
@mui/x-date-pickers: ^6.9.2 => 6.9.2
@mui/x-license-pro: ^6.10.2 => 6.10.2
@types/react: ^17.0.38 => 17.0.39
react: 17.0.2 => 17.0.2
react-dom: 17.0.2 => 17.0.2
typescript: ^4.5.5 => 4.5.5

Search keywords: datagrid disable event on edit cell
Order ID: 68257

@Kohei909Otsuka Kohei909Otsuka added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Nov 13, 2023
@Kohei909Otsuka Kohei909Otsuka changed the title [question] [question] custom cell with edit modal which dose not close unexpectedly Nov 13, 2023
@DanailH DanailH changed the title [question] custom cell with edit modal which dose not close unexpectedly [question] custom cell with edit modal which does not close unexpectedly Nov 16, 2023
@DanailH
Copy link
Member

DanailH commented Nov 16, 2023

Hi @Kohei909Otsuka thanks for raising this. I think you can find more about how to solve your problem here: https://mui.com/x/react-data-grid/editing/#editing-events

The following demo shows how to prevent the user from exiting edit mode when clicking outside of a cell. To do this, the onCellEditStop prop is used to check if the reason is 'cellFocusOut'. If that condition is true, it [disables](https://mui.com/x/react-data-grid/events/#disabling-the-default-behavior) the default event behavior. In this context, the user can only stop editing a cell by pressing Enter, Escape, or Tab.

Let me know if this is what you are looking for.

@DanailH DanailH added status: waiting for author Issue with insufficient information component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Nov 16, 2023
@DanailH DanailH changed the title [question] custom cell with edit modal which does not close unexpectedly [data grid] Custom cell with edit modal which does not close unexpectedly Nov 16, 2023
Copy link

The issue has been inactive for 7 days and has been automatically closed. If you think that it has been incorrectly closed, please reopen it and provide missing information (if any) or continue the last discussion.

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! status: waiting for author Issue with insufficient information support: commercial Support request from paid users
Projects
None yet
Development

No branches or pull requests

2 participants