-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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] Aggregated columns don't respond to changes in the "editable" property of the GridColDef #10864
Comments
@JohannesByle the problem is not with the property itself but rather the way you control it. In order to change column configuration once the grid is initially loaded you need to use |
Thanks for the quick response. I had read that section of the docs, but because the two different columns behaved differently I assumed it was a bug. In my case I have props that control whether or not a column is editable. Would the correct approach be to update the columns in a useEffect like this? const {editable} = props;
useEffect(() => {
const cols = baseCols.map((c)=> ({...c, editable}));
apiRef.current.updateColumns(cols);
}, [editable]); |
After doing further testing it looks like it's broken for the |
Ah ok, I can confirm, It doesn't seem to be working. |
this is a fairly huge bug.. any update on progress? |
@scamden I've added it for today's grooming session so we can discuss and see how to proceed. |
This is a regression from #9334 v6.9.2: https://codesandbox.io/s/shy-wildflower-xqzpqp The relevant change is here: https://github.com/mui/mui-x/pull/9334/files#diff-d6677e3149e60f2ede0c6ad76a8014630705d0668b5d8c92284a8e643d75a145 |
Steps to reproduce
Link to live example: (required)
https://codesandbox.io/s/cranky-carson-v8g2v7?file=/src/demo.tsx
Steps:
Current behavior
When controlling a columns
editable
property using a stateful value aggregated columns don't respond to changes to the value. So in the codesandbox example theeditable
state of the aggregatedunitPrice
column always reflects the initial value of the useState variable. The un-aggregatedquantity
column reflects the correct state.Expected behavior
I would expect
editable
state of the aggregated column to reflect the state in the GridColDef. In the case of this example I would expect theunitPrice
column to behave like thequantity
column.Context
I had a grid to display sub-items based on items selected in a sidebar. Some of these items are read only, others are editable. The column I was editing happened to be aggregated, and after switching to v6 I noticed that I couldn't edit the column anymore. I was able to work around the issue by placing a key on the parent component so that its state reset whenever the item changed.
Your environment
npx @mui/envinfo
Search keywords: aggregation, editing
Order ID: 71096
The text was updated successfully, but these errors were encountered: