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

[DataGridPremium] heavy customisation of menu panels. #5976

Closed
2 tasks done
Tracked by #9328
toinhao1 opened this issue Aug 31, 2022 · 4 comments
Closed
2 tasks done
Tracked by #9328

[DataGridPremium] heavy customisation of menu panels. #5976

toinhao1 opened this issue Aug 31, 2022 · 4 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user support: commercial Support request from paid users

Comments

@toinhao1
Copy link

Order ID 💳

46557

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

The problem in depth 🔍

I am trying to heavily style the buttons and panels for the various grid functionality, such as filtering, columns, export, and density.

For filtering I see in the documentation: here https://mui.com/x/react-data-grid/filtering/#customize-the-filter-panel-content and here: https://mui.com/x/react-data-grid/filtering/#customize-the-filter-panel-position.

Even with this it is not very straightforward on how to properly style the Filter panel.

I am now trying to figure out how to style the ColumnVisibility Panel, but can not find anywhere in the documentation or in an issue of how to do this.
Screenshot 2022-08-31 at 14 15 17

Also, I see how we can position the Panel beneath lets say the Filters button:
Screenshot 2022-08-31 at 14 12 02

But then all of the other panels are positioned where the Filters panel is.

How can I properly style the ColumnVisibility Panel without having to create an entirely custom one?
How can I ensure that each panel respective to each button is placed directly below it? Like this:
Screenshot 2022-08-31 at 14 14 32

Your environment 🌎

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

toinhao1 commented Sep 1, 2022

We were able to figure out how to style the columnsPanel through componentProps like this:

columnsPanel: { sx: all styles here, }

Is there anyway to have the location of this panel and the filter panel be in different locations?

@alexfauquette
Copy link
Member

Effectively, to style the panels, you need to pass the sx prop to the component itself, beacause they are rendered outside of the scope of the data gird

For the position, it's a bit more tricky, because we have only one panel that renders either the filter panel or the column panel. Depending on the one which is open. So we can only pass on anchorEl

A workaround is to override the default panel such that looks at the currently open element and adapt the anchorEl according to to it. Here is an example:
https://codesandbox.io/s/customfilterpanelposition-demo-mui-x-forked-ddv6y4?file=/demo.tsx


Maybe a later improvement could be to add two props filterAnchorEl and columnsAnchorEl such that the position is
anchorEl={filterAnchorEl || anchorEl}

@toinhao1
Copy link
Author

toinhao1 commented Sep 2, 2022

Thank you!

@toinhao1 toinhao1 closed this as completed Sep 2, 2022
@alexfauquette
Copy link
Member

alexfauquette commented Sep 2, 2022

@cherniavskii Should it be added into the receipt pages? like a section "customizing panels"

@zannager zannager added component: data grid This is the name of the generic UI component, not the React module! plan: Premium Impact at least one Premium user labels Dec 20, 2022
@zannager zannager removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Jan 11, 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! plan: Premium Impact at least one Premium user support: commercial Support request from paid users
Projects
None yet
Development

No branches or pull requests

3 participants