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.1k stars 1.27k forks source link

[data grid] Is there a property to tell the grouping row column to ignore the valueFormatter/renderCell ? #13572

Open john1625b opened 3 months ago

john1625b commented 3 months ago

The problem in depth

When a DataGrid is grouped by a column, by default the grouping row uses the custom cell renderer. I know its possible to override this behaviour by using renderCell and doing:

      renderCell: ({ row: { field }, rowNode }) => {
        if (rowNode.type === 'group') {
          return field;
        }

But this becomes tedious because in my case we have several tables that are 30+ columns that all have a valueFormatter.

Is there a property on the column or the Datagird where I can specify that the column for the grouping row can ignore the valueFormatter/ renderCell?

example where every column has valueFormatter and its a pain to have to override the grouping renderer: https://stackblitz.com/edit/react-ch8hus?file=Demo.tsx

Your environment

System: OS: macOS 14.5 Binaries: Node: 18.16.1 - ~/.nvm/versions/node/v18.16.1/bin/node npm: 9.8.1 - ~/.nvm/versions/node/v18.16.1/bin/npm pnpm: Not Found Browsers: Chrome: 126.0.6478.62 Edge: Not Found Safari: 17.5 npmPackages: @emotion/react: ^11.11.1 => 11.11.1 @emotion/styled: ^11.11.0 => 11.11.0 @mui/base: 5.0.0-beta.40 @mui/core-downloads-tracker: 5.15.18 @mui/icons-material: ^5.14.1 => 5.15.15 @mui/material: ^5.15.14 => 5.15.18 @mui/private-theming: 5.15.14 @mui/styled-engine: 5.15.14 @mui/system: 5.15.15 @mui/types: 7.2.14 @mui/utils: 5.15.14 @mui/x-data-grid: 6.11.1 @mui/x-data-grid-generator: ^6.11.1 => 6.11.1 @mui/x-data-grid-premium: ^6.10.2 => 6.11.1 @mui/x-data-grid-pro: 6.11.1 @mui/x-date-pickers: 7.5.1 @mui/x-date-pickers-pro: ^7.5.1 => 7.5.1 @mui/x-license: 7.2.1 @mui/x-license-pro: 6.10.2 @types/react: ^18.2.15 => 18.2.15 react: ^18.2.0 => 18.2.0 react-dom: ^18.2.0 => 18.2.0 typescript: ^5.0.2 => 5.1.6

Search keywords: row grouping default column value Order ID: 72840

michelengelen commented 3 months ago

Hey @john1625b we don't have a property like this, but for the grouping column definition this definitely makes sense! I'll add this to the board