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] Add slot for the column header #6691

Closed
2 tasks done
mwardGresham opened this issue Oct 31, 2022 · 9 comments
Closed
2 tasks done

[data grid] Add slot for the column header #6691

mwardGresham opened this issue Oct 31, 2022 · 9 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: logic Logic customizability enhancement This is not a bug, nor a new feature feature: Rendering layout Related to the data grid Rendering engine status: waiting for author Issue with insufficient information support: commercial Support request from paid users

Comments

@mwardGresham
Copy link

mwardGresham commented Oct 31, 2022

Order ID 💳

45466

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I cant find a way to get access to the anchored cell (blue outlined selected cell) in the datagrid e.g. onAnchorCellChange

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@mwardGresham mwardGresham added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Oct 31, 2022
@zannager zannager added the component: data grid This is the name of the generic UI component, not the React module! label Oct 31, 2022
@cherniavskii
Copy link
Member

Hey @mwardGresham
Could you describe what you're trying to achieve?
Thanks!

@cherniavskii cherniavskii added support: question Community support but can be turned into an improvement status: waiting for author Issue with insufficient information and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Oct 31, 2022
@mwardGresham
Copy link
Author

Hello
We are looking to get an event when a cell is focused, to then get the column and row position and value. You have onCellFocusOut but no onCellFocus, is there a reason for this?

We're trying to get a context menu on our grid, it has to work for both the cells and header cells, but right clicking on cells doesn't cause onCellClick or onColumnHeaderClick to fire, we've seen the demo provided here (https://mui.com/x/react-data-grid/components/#row) but couldn't get it to work for cell headers and also doesn't return the row/header position of the selection.

Thanks

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Oct 31, 2022
@mwardGresham
Copy link
Author

Any update on this so we can progress?

@cherniavskii
Copy link
Member

Hey @mwardGresham

We are looking to get an event when a cell is focused, to then get the column and row position and value

You can use componentsProps.cell.onFocus:
https://codesandbox.io/s/modest-nova-bih4ch?file=/demo.tsx

but right clicking on cells doesn't cause onCellClick or onColumnHeaderClick to fire

This is expected. You have to use componentsProps.cell.onContextMenu to get the context menu event on the cells:
https://codesandbox.io/s/serverless-snow-2qgtec?file=/demo.tsx
For the column headers, I'm afraid it's not possible to subscribe to the contextMenu event right now.
We can add onColumnHeaderContextMenu prop to support it

@cherniavskii cherniavskii added customization: logic Logic customizability enhancement This is not a bug, nor a new feature feature: Rendering layout Related to the data grid Rendering engine and removed support: question Community support but can be turned into an improvement labels Nov 4, 2022
@m4theushw
Copy link
Member

we've seen the demo provided here (https://mui.com/x/react-data-grid/components/#row) but couldn't get it to work for cell headers and also doesn't return the row/header position of the selection.

Could you describe more the problem with the row position? In the demo you have the row ID.

For the column headers, I'm afraid it's not possible to subscribe to the contextMenu event right now.

Instead of adding a specific prop for the event, it's best to add a slot for the column header. It would also unlock developers to implement header filters like #4934 (comment) in their side.

@m4theushw m4theushw changed the title No event for when the anchor cell is updated in the datagrid [data grid] No event for when the anchor cell is updated in the datagrid Nov 4, 2022
@mwardGresham
Copy link
Author

A slot for the column header in components props would solve our issue I think, if that could be added?
The row position is no longer an issue thanks

@m4theushw m4theushw moved this to 🆕 Needs refinement in MUI X Data Grid Nov 7, 2022
@m4theushw m4theushw moved this from 🆕 Needs refinement to 🔖 Ready in MUI X Data Grid Nov 7, 2022
@m4theushw m4theushw changed the title [data grid] No event for when the anchor cell is updated in the datagrid [data grid] Add slot for the column header Nov 7, 2022
@mwardGresham
Copy link
Author

Hello, is it possible for us to get any ETA on this?

@cherniavskii
Copy link
Member

Hey @mwardGresham
Could you try using renderHeader for capturing the context menu event in the column header?
https://codesandbox.io/s/relaxed-minsky-yl8tws?file=/demo.tsx
Would that work for you?

@cherniavskii cherniavskii added the status: waiting for author Issue with insufficient information label Dec 23, 2022
@github-actions
Copy link

Since the issue is missing key information and has been inactive for 7 days, it has been automatically closed. If you wish to see the issue reopened, please provide the missing information.

@joserodolfofreitas joserodolfofreitas moved this from 🔖 Ready to ✅ Done in MUI X Data Grid Jan 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: logic Logic customizability enhancement This is not a bug, nor a new feature feature: Rendering layout Related to the data grid Rendering engine status: waiting for author Issue with insufficient information support: commercial Support request from paid users
Projects
Status: Done
Development

No branches or pull requests

4 participants