-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Improve support for DataGrid inside DataGrid #4243
Comments
You need to stop the propagation of the <div onClick={(event) => event.stopPropagation()}
<DataGrid />
</div> Here's the updated CodeSandbox: https://codesandbox.io/s/debug-modal-with-datagrid-forked-uvnqds?file=/src/TinyInfo.tsx:324-384 |
Thanks for the solution, really appreciate it. Is this something I'm expected to know? If so, how would one go about figure it out? |
No, this use case was tricky because is a DataGrid inside another DataGrid, considering the React tree. If you render any other component, not a DataGrid, it won't crash. I updated the label because there's an opportunity to improve the support for DataGrid inside DataGrid. The following function returns the incorrect element. mui-x/packages/grid/x-data-grid/src/components/GridRow.tsx Lines 156 to 158 in 249969c
When one cell from the child DataGrid is clicked, |
Thanks for the explanation. Guess that's what you get for liking DataGrid too much, putting DataGrid in DataGrid 😄 |
Stopping event propagation completely will mess up editable columns in the child onClick={(event) => event.target = document.body} |
Is there any progress on this solution? |
Can't believe this bug won't fix after a year But i am not sure if this workaround will affect anything about |
@m4theushw I'm having issues with some edit interactions in this use case when using your proposed solution. The solution proposed by others shown below does fix the issue, but I was wondering if you know of any reasons this could be potentially dangerous or introduce side effects?
|
The issue is fixed in Data Grid v7: https://stackblitz.com/edit/react-s3awys?file=Demo.tsx |
@C-Pettersson: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Duplicates
Latest version
Current behavior 😯
Pressing a cell shouldn't return an error saying the column is undefined.
Expected behavior 🤔
Cell should be selected or at least no error.
Steps to reproduce 🕹
codesandbox:
Link
Steps:
Context 🔦
I'm trying to show additional information in a Modal
Your environment 🌎
`npx @mui/envinfo`
Order ID 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: