Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[data grid] valueGetter fallback not applied in renderCell #16226

Closed
aress31 opened this issue Jan 17, 2025 · 2 comments
Closed

[data grid] valueGetter fallback not applied in renderCell #16226

aress31 opened this issue Jan 17, 2025 · 2 comments
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information

Comments

@aress31
Copy link

aress31 commented Jan 17, 2025

Steps to reproduce

Read description.

Current behavior

Consider the following column definition:

 ARRAY: {
    display: "flex",
    renderCell: (params) => {
      console.log(params.value);
      return <ChipsColumn params={params} />;
    },
    valueGetter: (value) => {
      if (!value) return [];

      const formattedValue = value
        ? Array.isArray(value)
          ? value
          : [value].filter(Boolean);
      return formattedValue;
    },
  },

Image

I am passing an array to render Chips, and although I’ve provided a fallback value (an empty array) in the valueGetter, when no row/value is YET available (fetching rows), undefined is still passed to renderCell. Is it possible to modify this behaviour so that the valueGetter can be used to define fallback values?

Expected behavior

Read description.

Context

Read description.

Your environment

npx @mui/envinfo
  System:
    OS: Windows 10 10.0.19045
  Binaries:
    Node: 23.3.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.9.2 - C:\Program Files\nodejs\npm.CMD
    pnpm: 9.13.2 - ~\AppData\Local\pnpm\pnpm.EXE
  Browsers:
    Chrome: Not Found
    Edge: Chromium (129.0.2792.65)
  npmPackages:
    @emotion/react: ^11.14.0 => 11.14.0
    @emotion/styled: ^11.14.0 => 11.14.0
    @mui/base:  5.0.0-beta.68
    @mui/core-downloads-tracker:  6.4.0
    @mui/icons-material: ^6.4.0 => 6.4.0
    @mui/lab:  6.0.0-beta.23
    @mui/material: ^6.4.0 => 6.4.0
    @mui/private-theming:  6.4.0
    @mui/styled-engine:  6.4.0
    @mui/system:  6.4.0
    @mui/types:  7.2.21
    @mui/utils:  6.4.0
    @mui/x-charts: ^7.23.6 => 7.23.6
    @mui/x-charts-vendor:  7.20.0
    @mui/x-data-grid: ^7.23.6 => 7.23.6
    @mui/x-date-pickers: ^7.23.6 => 7.23.6
    @mui/x-internals:  7.23.6
    @toolpad/core: ^0.11.0 => 0.11.0
    @toolpad/utils:  0.11.0
    @types/react: ^18.3.1 => 18.3.18
    react: ^18.3.1 => 18.3.1
    react-dom: ^18.3.1 => 18.3.1
    typescript:  5.7.3

Search keywords: gridCol, valueGetter

@aress31 aress31 added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 17, 2025
@michelengelen
Copy link
Member

To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! ✨

For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction

Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself!

Thanks for your understanding! 🙇🏼

@michelengelen michelengelen added status: waiting for author Issue with insufficient information component: data grid This is the name of the generic UI component, not the React module! and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 17, 2025
@michelengelen michelengelen changed the title [valueGetter] Fallback Not Applied in renderCell [data grid] valueGetter fallback not applied in renderCell Jan 17, 2025
Copy link

The issue has been inactive for 7 days and has been automatically closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information
Projects
None yet
Development

No branches or pull requests

2 participants