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] Controlling headerAlign in GridColumnGroupingModel globally #16973

Open
nodirbekprogrammer opened this issue Mar 15, 2025 · 4 comments
Labels
component: data grid This is the name of the generic UI component, not the React module! customization: css Design CSS customizability enhancement This is not a bug, nor a new feature feature: Column groups Related to the data grid Column groups feature

Comments

@nodirbekprogrammer
Copy link

nodirbekprogrammer commented Mar 15, 2025

Summary

Where I group columns, I have to repeatedly specify center for headerAlign. It should be center by default or possible to change it by passing some property to the DataGrid.

Examples

No response

Motivation

No response

Search keywords: column, grouping, headerAlign

@nodirbekprogrammer nodirbekprogrammer added new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 15, 2025
@michelengelen
Copy link
Member

To help us diagnose the issue efficiently, could you provide a stripped-down reproduction test case using the latest version? A live example would be fantastic! ✨

For your convenience, our documentation offers templates and guides on creating targeted examples: Support - Bug reproduction

Just a friendly reminder: clean, functional code with minimal dependencies is most helpful. Complex code can make it tougher to pinpoint the exact issue. Sometimes, simply going through the process of creating a minimal reproduction can even clarify the problem itself!

Thanks for your understanding! 🙇🏼

@michelengelen michelengelen changed the title Controlling headerAlign in GridColumnGroupingModel globally [data grid] Controlling headerAlign in GridColumnGroupingModel globally Mar 17, 2025
@michelengelen michelengelen added 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! status: waiting for author Issue with insufficient information and removed new feature New feature or request status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 17, 2025
@nodirbekprogrammer
Copy link
Author

@michelengelen Link

@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 Mar 17, 2025
@michelengelen
Copy link
Member

michelengelen commented Mar 17, 2025

Hey @nodirbekprogrammer and thanks for the follow-up. There currently is no global setting for this, so you would need to either ...

  • ... set it for every column manually, or ...
  • ... use a global styling (e.g. with the sx prop) like below:
    sx={{
      [`& .${gridClasses.columnHeaderTitleContainer}`]: {
        justifyContent: 'center',
      },
    }}

I agree that both are only mitigating for now, so I will add this to the board to discuss a global prop or similar. Thanks!

@michelengelen michelengelen added customization: css Design CSS customizability feature: Column groups Related to the data grid Column groups feature and removed status: waiting for maintainer These issues haven't been looked at yet by a maintainer labels Mar 17, 2025
@github-project-automation github-project-automation bot moved this to 🆕 Needs refinement in MUI X Data Grid Mar 17, 2025
@michelengelen michelengelen added enhancement This is not a bug, nor a new feature and removed support: question Community support but can be turned into an improvement labels Mar 17, 2025
@nodirbekprogrammer
Copy link
Author

@michelengelen Thank you. The second approach is enough for me for now.

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: css Design CSS customizability enhancement This is not a bug, nor a new feature feature: Column groups Related to the data grid Column groups feature
Projects
Status: 🆕 Needs refinement
Development

No branches or pull requests

2 participants