-
-
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
[question] How do I get the updated value of an edited field under getActions
?
#11218
Comments
@MBilalShafi I tagged this as regression, but is it really a regression? I can see some value in disabling the saving button when no actual changes are present, though I am not sure if we can support this with our implementation atm. Could you please help out here? |
Yeah ... IMO it felt like it was intended to behave that way, or rather the behavior before was unintended. Thanks for clarifying that @MBilalShafi 👍🏼 |
definitely need this. if it was unintended behavior before, it has unfortunately caused a regression on our end and is blocking us to upgrade to v6 😭 |
It's an intended behavior. Previously, we were re-rendering every cell at every change. Now, we re-render only when the cell state has actually changed. To make your actions cell re-render when something changes, you need to establish a reactive binding to the grid's state with Here is the fixed version: https://codesandbox.io/p/sandbox/blissful-frog-grhj9z?file=%2Fdemo.js%3A145%2C36 It's not obvious from the name, but |
This is explained in more details in the docs: https://mui.com/x/react-data-grid/state/#access-the-state |
Nice, this works for me now. Thanks @romgrk ! |
The problem in depth 🔍
How do we set the value of disabled prop whenever cell value has changed? In v5 we were able to change the disabled prop when the custom edit cell value has changed. e.g, below is this recording where save button should only be enabled when name has a value.
v5.mov
We are running into a degrade of this behavior on the v6 version. Looks like actions cell type doesn't get rerendered everytime we call
api.current.setEditCellValue
triggered on text value change, and is now causing the save button to still be disabled even after filling in a name. Here's the recording of the updated code in v6:v6.mov
and here's the sandbox link: https://codesandbox.io/p/sandbox/festive-alex-zqhhz4?file=%2Fdemo.js%3A1%2C19
Your environment 🌎
`npx @mui/envinfo`
Search keywords: datagrid cell editing
Order ID: 51218
The text was updated successfully, but these errors were encountered: