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] GridToolbarColumnsButton does not open popover when onClick is defined #16355

Closed
marcelo-cardozo opened this issue Jan 27, 2025 · 6 comments · Fixed by #16356
Closed
Assignees
Labels
bug 🐛 Something doesn't work regression A bug, but worse

Comments

@marcelo-cardozo
Copy link

marcelo-cardozo commented Jan 27, 2025

Steps to reproduce

Steps:

  1. Open this link to live example: https://stackblitz.com/edit/react-3lpvhggp?file=Demo.tsx
  2. Click on the columns button
  3. Popover is not displayed

Current behavior

  1. Open this link to live example: https://stackblitz.com/edit/react-3lpvhggp?file=Demo.tsx
  2. Click on the columns button
  3. Popover is not displayed

Expected behavior

  1. Open this link to live example: https://stackblitz.com/edit/react-3lpvhggp?file=Demo.tsx
  2. Click on the columns button
  3. Popover should be displayed, else provide a way to open/close the columns popover to the consumer

Context

#15556 (comment)

Your environment

npx @mui/envinfo

System:
OS: macOS 13.2.1
Binaries:
Node: 20.18.0 - ~/.nvm/versions/node/v20.18.0/bin/node
npm: 10.8.2 - ~/.nvm/versions/node/v20.18.0/bin/npm
pnpm: Not Found
Browsers:
Chrome: 131.0.6778.265
Edge: Not Found
Safari: 16.3
npmPackages:
@mui/x-data-grid-premium: 7.24.1

Search keywords: GridToolbarColumnsButton

@marcelo-cardozo marcelo-cardozo added bug 🐛 Something doesn't work status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 27, 2025
@github-actions github-actions bot changed the title [DataGrid] GridToolbarColumnsButton does not open popover the onClick button is defined [data grid] GridToolbarColumnsButton does not open popover the onClick button is defined Jan 27, 2025
@marcelo-cardozo
Copy link
Author

duplicate of #16354

@KenanYusuf
Copy link
Member

Thanks for opening the issue @marcelo-cardozo, I'll keep this one open because you have added more context.

@KenanYusuf KenanYusuf changed the title [data grid] GridToolbarColumnsButton does not open popover the onClick button is defined [data grid] GridToolbarColumnsButton does not open popover when onClick is defined Jan 27, 2025
@KenanYusuf KenanYusuf added regression A bug, but worse bug 🐛 Something doesn't work and removed bug 🐛 Something doesn't work labels Jan 27, 2025
@KenanYusuf KenanYusuf self-assigned this Jan 27, 2025
@jyash97
Copy link

jyash97 commented Jan 27, 2025

@KenanYusuf

Was just checking the code, should we destructure onClick from buttonProps spread ? And create a function called handleClick which triggers showColumns and the user passed onClick as well ?

Code reference: https://github.com/mui/mui-x/blob/master/packages/x-data-grid/src/components/toolbar/GridToolbarColumnsButton.tsx#L79

happy to raise a PR, if this sounds good!

@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Jan 27, 2025
@KenanYusuf KenanYusuf moved this from 🆕 Needs refinement to 🏗 In progress in MUI X Data Grid Jan 27, 2025
Copy link

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

@marcelo-cardozo How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey.

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 28, 2025
@KenanYusuf
Copy link
Member

Thanks for the suggestion and offer to fix @jyash97—we were already calling buttonProps.onClick in the showColumns function so the fix was a bit simpler, just needed to move the onClick to after the {...buttonProps} spread https://github.com/mui/mui-x/pull/16356/files.

@jyash97
Copy link

jyash97 commented Jan 28, 2025

Yes just checked the PR, makes sense 💯

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work regression A bug, but worse
Projects
Status: 🏗 In progress
Development

Successfully merging a pull request may close this issue.

3 participants