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] Show detail panel on onRowClick #7596

Closed
2 tasks done
Tracked by #9328
dennisobel opened this issue Jan 17, 2023 · 3 comments · Fixed by #14666
Closed
2 tasks done
Tracked by #9328

[data grid] Show detail panel on onRowClick #7596

dennisobel opened this issue Jan 17, 2023 · 3 comments · Fixed by #14666
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: logic Logic customizability docs Improvements or additions to the documentation feature: Master-detail Related to the data grid Master-detail feature recipe support: question Community support but can be turned into an improvement

Comments

@dennisobel
Copy link

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Summary 💡

Currently MUI DataGridPro only supports showing details when a specific column is clicked on. Is it possible to have getDetailPanelContent fired onRowClick especially on mobile views where we don't have much realestate.

Examples 🌈

No response

Motivation 🔦

I would like to save on space on mobile view by making it possible to click on row rather than on specific column to display details.

@dennisobel dennisobel added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 17, 2023
@flaviendelangle flaviendelangle transferred this issue from mui/material-ui Jan 18, 2023
@cherniavskii
Copy link
Member

Hey @dennisobel
You can toggle the detail panel on row click using apiRef:

const onRowClick = React.useCallback<GridEventListener<"rowClick">>(
  (params) => {
    apiRef.current.toggleDetailPanel(params.id);
  },
  [apiRef]
);

<DataGridPro
  onRowClick={onRowClick}
/>

Here's a demo: https://codesandbox.io/s/patient-leaf-vz5vqr?file=/demo.tsx

@cherniavskii cherniavskii added docs Improvements or additions to the documentation support: question Community support but can be turned into an improvement 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 and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Jan 18, 2023
@cherniavskii
Copy link
Member

We can add a recipe with this demo to the docs

@m4theushw m4theushw changed the title Show datagridpro details onRowClick [data grid] Show detail panel on onRowClick Jan 18, 2023
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

@dennisobel 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.

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 docs Improvements or additions to the documentation feature: Master-detail Related to the data grid Master-detail feature recipe support: question Community support but can be turned into an improvement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants