mui / mui-x

MUI X: Build complex and data-rich applications using a growing list of advanced React components, like the Data Grid, Date and Time Pickers, Charts, and more!
https://mui.com/x/
3.91k stars 1.19k forks source link

[data grid] Change child table width on change of parent table #13603

Open ashishchoudhary12 opened 1 week ago

ashishchoudhary12 commented 1 week ago

Steps to reproduce

Link to live example: (required)

Steps: 1. 2. 3.

Current behavior

I have implemented a MUI Grid containing two tables. One table is nested within the other, allowing me to display common fields in the parent table and additional details in the child table. Here is the link

I am using the onColumnWidthChange event in my MUI Grid implementation.

  1. The event does not trigger when the rows are collapsed.
  2. When a row is expanded, the event only affects the expanded row and does not impact the collapsed rows.

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo ``` Don't forget to mention which browser you used. Output from `npx @mui/envinfo` goes here. ```

Search keywords: Change child table width on change of parent table

michelengelen commented 6 days ago

This is because the component in the details is not rendered when it is collapsed. You would need to access the current state of the "parent" grid and apply the column widths to the child on render.

michelengelen commented 6 days ago

as mentioned in #13194 I would advise to use the tree data or grouping feature instead