-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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] How to disable collapse button for DataGrid Master detail conditionally? #13108
Comments
Hey @sanlee13 To accomplish this you would need to pass a custom cell renderer to the toggle column and find a way to pass the edit state from your master detail to that toggle renderer. Could you maybe provide us with a minimal reproduction demo in codesandbox or stackblitz? That would help a lot! |
Hey @michelengelen, Here is a sandbox I made: https://codesandbox.io/p/sandbox/quirky-ptolemy-hdlrzd?file=%2Fsrc%2FDemo.js%3A25%2C5 EDIT: Keep an eye on the console |
Hey @michelengelen, Thank you very much for your assistance. |
Great that this solution works for you. @cherniavskii should we maybe add this as a recipe to the docs? |
@michelengelen I don't love the idea of mutating row data to reflect the editing state TBH.
https://codesandbox.io/p/sandbox/silent-frog-tqp59h What do you think? |
Yes, that's a great solution. Thanks for providing that solution ... the question still stands though: should we add something like this as a recipe? |
It seems to be a quite niche use case, I would wait for upvotes on this first. |
The problem in depth
Hello,
I have a DataGrid that makes use of the master details, when I expand a row, I display an edit button which toggles an edit mode flag, when the edit mode is enabled, I want the collapse button to be disabled and removed to prevent the user from clicking it by mistake. This seems like a trivial task but am unable to find a way to do this.
Thanks for your time
Your environment
`npx @mui/envinfo`
Search keywords: disable collapse button for DataGrid Master detail.
Order ID: 82571
The text was updated successfully, but these errors were encountered: