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

Is there a way to toggle the detail panel from within a menu instead of on cell click? #7115

Closed
2 tasks done
pjwise-korio opened this issue Dec 7, 2022 · 7 comments
Closed
2 tasks done
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: logic Logic customizability feature: Master-detail Related to the data grid Master-detail feature plan: Pro Impact at least one Pro user support: commercial Support request from paid users support: question Community support but can be turned into an improvement

Comments

@pjwise-korio
Copy link

pjwise-korio commented Dec 7, 2022

Order ID 💳

50140

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

Looking for the best way to toggle master detail panel within a menu instead of immediately after cell click.

I'm currently using GRID_DETAIL_PANEL_TOGGLE_FIELD in my column definitions like so
{ field: GRID_DETAIL_PANEL_TOGGLE_FIELD, flex: 1, headerName: 'Details', sortable: false, align: 'right', headerAlign: 'right', renderCell: (params: GridRenderCellParams) => { return ( <> <IconButton aria-label='expand row' size='small' onClick={handleClickListItem} id='user_options'> <MoreVertIcon /> </IconButton> <Menu id='user-more-menu' anchorEl={anchorEl} open={open} onClose={handleClose} MenuListProps={{ 'aria-labelledby': 'lock-button', role: 'listbox', }} > {options.map((option: any, index: any) => ( <MenuItem key={option} value={option} id={option-${index}} // selected={index === selectedIndex} onClick={(event: any) => handleMenuItemClick(option, event, index, rows._id)} > {option} </MenuItem> ))} </Menu> </> ); }, }

is there a way to toggle the expansion of the detail panel on "View User Profile" click instead?

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.
@pjwise-korio pjwise-korio added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: commercial Support request from paid users labels Dec 7, 2022
@pjwise-korio
Copy link
Author

image

@zannager zannager added component: data grid This is the name of the generic UI component, not the React module! plan: Pro Impact at least one Pro user labels Dec 7, 2022
@cherniavskii
Copy link
Member

Hey @pjwise-korio
You can do the following:

  1. Hide the detail panel toggle column using columnVisibilityModel
  2. Use actions column type to add a row menu
  3. Toggle the detail panel using apiRef

Here's a working demo: https://codesandbox.io/s/focused-kare-3gyd7l?file=/demo.tsx

Let me know if this is sufficient for your use case.

@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 Dec 7, 2022
@pjwise-korio
Copy link
Author

@cherniavskii Thank you very much for the codepen. Reviewing it now!

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Dec 8, 2022
@cherniavskii cherniavskii added the status: waiting for author Issue with insufficient information label Dec 8, 2022
@pjwise-korio
Copy link
Author

@cherniavskii This works much better than the way I originally had this set up. Thank you very much! I did have one question that came up during set up - what is the difference between GridColumns and GridColDef?

@github-actions github-actions bot removed the status: waiting for author Issue with insufficient information label Dec 13, 2022
@cherniavskii
Copy link
Member

what is the difference between GridColumns and GridColDef?

GridColDef doesn't allow to declare actions column type. GridColumns does. You can also use GridEnrichedColDef instead of GridColDef.

I'll open a discussion to make this less confusing in v6. I believe we can eliminate the need of using GridColumns and GridEnrichedColDef.

@cherniavskii
Copy link
Member

@pjwise-korio I've created this RFC #7188. Feel free to comment if you want to share your opinion on this :)

@cherniavskii
Copy link
Member

I'm closing this issue, since it's resolved

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 feature: Master-detail Related to the data grid Master-detail feature plan: Pro Impact at least one Pro user support: commercial Support request from paid users support: question Community support but can be turned into an improvement
Projects
None yet
Development

No branches or pull requests

3 participants