Datagrid only has 3 columns when filters are applied and the Datagrid is hidden via { display: none }; #8538
Labels
component: data grid
This is the name of the generic UI component, not the React module!
plan: Pro
Impact at least one Pro user
Duplicates
Latest version
Steps to reproduce 🕹
Link to live example: https://codesandbox.io/s/datagrid-pro-shared-filters-1qpix9?file=/src/App.tsx
Steps to reproduce:
Confirm that this is related to Tabs (presumably
display: none
)<Tabpanel>
wrappers out so the Datagrids are both displayed in aBox
Current behavior 😯
I have a case where I'm sharing filters between two different datagrids in tab panels. The tab panels are configured to be hidden via CSS when they are not active so the Datagrids are rendered even when they are not visible. For more context see #8489.
When the Datagrids are both rendered and visible, the filtering works as expected; changing the filters in one Datagrid results in the same filters being applied to the other Datagrid. However, when the Datagrids are in Tabs, and one is hidden via
display: none
on its container, setting filters will result in the hidden tab only having 3 columns (regardless of the total number of columns). This is despite both sets of visible rows being observably correct inonStateChange
. The columns aren't just hidden by CSS; they are not in the JSX/dom. Unless I'm missing something obvious, it seems like this behavior only happens when filters are applied when the CSS display property is set to none 🤔Expected behavior 🤔
I would expect the Datagrids to behave exactly the same whether they are both visible or one is hidden via
display: none
Context 🔦
I'm sharing filters between two Datagrids and setting the visible rows for each Datagrid to state so I can used the filtered rows outside of the datagrid. For more context see #8489.
Your environment 🌎
npx @mui/envinfo
Tested in Firefox and Chrome
Order ID or Support key 💳 (optional)
No response
The text was updated successfully, but these errors were encountered: