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

[DataGrid] Implement Column groups #295

Closed
2 tasks done
mchelen opened this issue Oct 24, 2019 · 7 comments
Closed
2 tasks done

[DataGrid] Implement Column groups #295

mchelen opened this issue Oct 24, 2019 · 7 comments
Labels
component: data grid This is the name of the generic UI component, not the React module!

Comments

@mchelen
Copy link

mchelen commented Oct 24, 2019

The fixed header option in https://material-ui.com/components/tables/#fixed-header is not compatible with multiple header rows from this example https://github.com/mui-org/material-ui/blob/master/docs/src/pages/components/tables/SpanningTable.js

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

The second header row is sticky, but not the first.

Expected Behavior 🤔

Both first and second header row should be sticky.

Steps to Reproduce 🕹

Steps:

  1. Create a <Table> with stickyHeader prop (reference: https://material-ui.com/components/tables/#fixed-header )
  2. Create multiple <TableRow> inside <TableHead> (reference: https://github.com/mui-org/material-ui/blob/master/docs/src/pages/components/tables/SpanningTable.js )
  3. Scroll down, and second <TableRow> content will replace first

https://codesandbox.io/s/material-demo-vo8qp

Context 🔦

We want to display a table with multiple header rows, and have all those rows be fixed "sticky" when scrolling.

Your Environment 🌎

Tech Version
Material-UI v4.5.1
React 16.11.0
Browser Chrome
@oliviertassinari
Copy link
Member

@mchelen Thanks for the feedback. It's not supported with the stickyHeader prop. I think that it's something we should support in the upcoming data tables component. In the meantime, you would need to use 2 <tables> elements.

@oliviertassinari oliviertassinari self-assigned this Nov 19, 2019
@oliviertassinari
Copy link
Member

oliviertassinari commented Dec 9, 2019

As a workaround, you can do

            <TableRow>
              {columns.map(column => (
                <TableCell
                  key={column.id}
                  align={column.align}
-                 style={{ minWidth: column.minWidth }}
+                 style={{ minWidth: column.minWidth, top: 57 }}
                >

https://codesandbox.io/s/material-demo-r1p51

Capture d’écran 2019-12-09 à 20 20 09

@mchelen
Copy link
Author

mchelen commented Dec 9, 2019

Thanks, that's what we did but when scrolling the second header row overwrites the first one.

@oliviertassinari
Copy link
Member

@mchelen Can you reproduce this issue with the codesandbox I have provided in my previous comment?

@mchelen
Copy link
Author

mchelen commented Dec 9, 2019

Oh cool, yeah that works! I was looking at your sandbox and that change wasn't saved there. Here it is with the change: https://codesandbox.io/s/material-demo-r1p51

@oliviertassinari oliviertassinari removed their assignment Feb 1, 2020
@oliviertassinari
Copy link
Member

oliviertassinari commented Sep 4, 2020

Moving to #195

@oliviertassinari oliviertassinari changed the title Table sticky header incompatible with multiple headers [DataGrid] Implement Column groups Sep 4, 2020
@oliviertassinari oliviertassinari transferred this issue from mui/material-ui Sep 17, 2020
@oliviertassinari oliviertassinari added the component: data grid This is the name of the generic UI component, not the React module! label Sep 17, 2020
@ndtreviv
Copy link

Why is this issue title prefixed with [DataGrid] when it's not about DataGrid at all?

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!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants