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] Cell event handlers props have null|undefined API reference #16866

Open
joelbalcaen opened this issue Mar 7, 2025 · 1 comment
Open
Labels
bug 🐛 Something doesn't work component: data grid This is the name of the generic UI component, not the React module!

Comments

@joelbalcaen
Copy link

joelbalcaen commented Mar 7, 2025

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-wphxoc24?file=Demo.tsx
  2. Open the developer tools console
  3. Focus on a cell
  4. Hit any keyboard key and/or click on a cell
  5. The api references passed to the onCellKeyDown, onCellClick handlers are null or undefined

Current behavior

The Grid API references in the params and details arguments of the onCellKeyDown and onCellClick event handler are undefined or null.

Expected behavior

I expect the grid cell params argument to contain a reference to the Grid API as described here https://mui.com/x/api/data-grid/grid-cell-params/

Context

I am trying to apply a custom cell keydown event handler to all Datagrid in our project using the theme. My use case requires the use of the Grid API. I'm not defining the event handler inside of a React component so I don't have access to the hooks which return a reference to the Grid API

Your environment

npx @mui/envinfo
  System:
    OS: macOS 12.7.3
  Binaries:
    Node: 21.7.1 - /opt/homebrew/bin/node
    npm: 10.5.0 - /opt/homebrew/bin/npm
    pnpm: Not Found
  Browsers:
    Chrome: 133.0.6943.142
    Edge: Not Found
    Safari: 15.6.1

Search keywords: cell event handler api null undefined

@joelbalcaen joelbalcaen added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 7, 2025
@github-actions github-actions bot added the component: data grid This is the name of the generic UI component, not the React module! label Mar 7, 2025
@oliviertassinari oliviertassinari changed the title cell event handlers props have null|undefined API reference [data grid] Cell event handlers props have null|undefined API reference Mar 7, 2025
@michelengelen
Copy link
Member

Thanks for opening this issue @joelbalcaen ... we do not pass the api here, which is incorrect.
I'll add this to the board for the team to have a look into this. 👍🏼

@michelengelen michelengelen removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Mar 10, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Mar 10, 2025
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!
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

2 participants