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.79k stars 1.12k forks source link

[question] using `gridFilteredSortedRowEntriesSelector` on a hidden `DataGrid` #12819

Closed wlee-vendelux closed 2 weeks ago

wlee-vendelux commented 2 weeks ago

The problem in depth

I am using gridExpandedSortedRowEntriesSelector to select the filtered rows after a filterModel update. It works great when the table is visible, but I'm building a separate view mode that hides the table so I can re-use the filtering thats built into DataGrid.

hidden DataGrid using CSS:

  .MuiDataGrid-main {
    visibility: ${hidden ? 'hidden' : 'visible'};
    position: ${hidden ? 'absolute' : 'relative'};
    width: 100%; // ensure it occupies full width to avoid shrinking
    height: ${hidden
      ? '0px'
      : 'auto'}; // optionally reduce height to 0 when hidden
  }

i noticed that gridExpandedSortedRowEntriesSelector stops working if the DataGrid is not visible. Is there any way around this?

Your environment

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

Search keywords: datagrid gridFilteredSortedRowEntriesSelector filter filtering hidden Order ID: 69589

wlee-vendelux commented 2 weeks ago

nevermind i am dumb. this was a non-issue.

i accidentally had this in my code:

 <DataGridPremium
  ...
   rows={selectedTabValue === PlannerTab.Calendar ? [] : events}
 />
github-actions[bot] commented 2 weeks ago

:warning: This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

@wlee-vendelux: How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.