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] Not able to have headerName for togglePanel #12261

Closed
ajayaccuknox opened this issue Feb 29, 2024 · 5 comments
Closed

[data grid] Not able to have headerName for togglePanel #12261

ajayaccuknox opened this issue Feb 29, 2024 · 5 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! status: waiting for author Issue with insufficient information support: docs-feedback Feedback from documentation page

Comments

@ajayaccuknox
Copy link

ajayaccuknox commented Feb 29, 2024

Related page

https://mui.com/x/react-data-grid/master-detail/

Kind of issue

Unclear explanations

Issue description

So I have a table in the table I need to show the master details under the each row so I have used toggleDetailPanel in that I made it successful but the issue is I couldn't able to have a separate column name like headerName

Context

So I have a table in the table I need to show the master details under the each row so I have used toggleDetailPanel in that I made it successful but the issue is I couldn't able to have a separate column name like headerName

Search keywords: headerName for togglePanel

@ajayaccuknox ajayaccuknox added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Feb 29, 2024
@MBilalShafi MBilalShafi changed the title Couldn't able to have headerName for togglePanel Couldn't able to have headerName for togglePanel Feb 29, 2024
@MBilalShafi MBilalShafi changed the title Couldn't able to have headerName for togglePanel [data grid] Couldn't able to have headerName for togglePanel Feb 29, 2024
@MBilalShafi MBilalShafi added the component: data grid This is the name of the generic UI component, not the React module! label Feb 29, 2024
@MBilalShafi
Copy link
Member

Could you expand on what you're trying to achieve?
Do you want to add the headerName on the header cell of the toggle button (the one with blue border in the image below)?

image

@MBilalShafi MBilalShafi added 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 Feb 29, 2024
@ajayaccuknox
Copy link
Author

Could you expand on what you're trying to achieve? Do you want to add the headerName on the header cell of the toggle button (the one with blue border in the image below)?

image

Yes exactly @MBilalShafi

@github-actions github-actions bot added status: waiting for maintainer These issues haven't been looked at yet by a maintainer and removed status: waiting for author Issue with insufficient information labels Feb 29, 2024
@michelengelen michelengelen changed the title [data grid] Couldn't able to have headerName for togglePanel [data grid] Not able to have headerName for togglePanel Mar 1, 2024
@michelengelen
Copy link
Member

@ajayaccuknox it is possible to render a custom header for the toggle column. You can use this section of the docs as a starting point: Customizing the detail panel toggle

What you have to do is:

  1. use GRID_DETAIL_PANEL_TOGGLE_COL_DEF definition in your columns
  2. spread the default definition and
  3. overwrite the renderHeader method

example:

const columns: GridColDef[] = [
  {
    ...GRID_DETAIL_PANEL_TOGGLE_COL_DEF,
    renderHeader: () => <div>Details</div>,
  },
  { field: 'id', headerName: 'Order ID' },
  { field: 'customer', headerName: 'Customer', width: 200 },
];

Just using headerName is not sufficient.

Let me know if this answers your question.

@MBilalShafi we could maybe add a recipe to show how that works. WDYT?

@michelengelen michelengelen added 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 Mar 4, 2024
@MBilalShafi
Copy link
Member

@michelengelen Sure, that could be useful, or we could improve this similar recipe by adding a custom headerName or at least a couple of lines which explain it in more detail. Wdyt?

Copy link

The issue has been inactive for 7 days and has been automatically closed.

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! status: waiting for author Issue with insufficient information support: docs-feedback Feedback from documentation page
Projects
None yet
Development

No branches or pull requests

3 participants