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/
4.07k stars 1.26k forks source link

How can I extend GridTreeDataGroupingCell component to include additional elements? #7612

Open rgavrilov opened 1 year ago

rgavrilov commented 1 year ago

Order ID πŸ’³

52426

Duplicates

Latest version

The problem in depth πŸ”

I want to add custom content to the GridTreeDataGroupingCell (https://sourcegraph.com/github.com/mui/mui-x/-/blob/packages/grid/x-data-grid-pro/src/components/GridTreeDataGroupingCell.tsx), instead of rendering child count - I want to render a list of icons. In my case, I want to mark groups that require the user's attention (an exclamation point icon).

I want to use GridTreeDataGroupingCell but add additional content after the count. It looks like your own approach is a copy-paste of the entire GridTreeDataGroupingCell implementation (e.g.: docs/data/data-grid/tree-data/TreeDataLazyLoading.tsx)

I was hoping there is a more OCP-friendly way to accomplish this simple extension.

My data-grid is non-editable, how bad would it be to use valueFormatter to return a ReactElement?

Your environment 🌎

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

There's definitely some room for improvement, we will take it into account.