-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Table] Sticky header in group #23090
Comments
Yeah, I think that you would need to set a different top position for each row of the header group. We also have mui/mui-x#195 in the pipeline. |
<TableHead>
<TableRow>
<TableCell align="center" colSpan={columns.length}>
Another header row
</TableCell>
</TableRow>
<TableRow>
<TableCell
style={{ top: 57 }}
align="center"
colSpan={columns.length}
> https://codesandbox.io/s/material-demo-forked-g12em?file=/demo.tsx |
We can probably improve the documentation for this aspect. It's also not obvious to find the group example introduced for #17909. |
Thanks for the quick heads-up. The custom styling did the trick. I presume it's not possible to apply the stickiness props to the |
It's not possible, to apply the sticky position on the thead, as far as I know. This would have been ideal. |
As simple as this: <Table>
<TableHead sx={{ position: 'sticky', top: 0, backgroundColor: 'white' }}>
<TableRow></TableRow>
<TableRow></TableRow>
<TableRow></TableRow>
</TableHead>
</Table> No stickyHeader, no pain. |
This works for me. I still use the stickyHeader prop to get the correct visual styles. I also change the background color of the header to white by using the themes background paper variable. <TableContainer sx={{ height: "100%" }}>
<Table size="small" stickyHeader>
<TableHead
sx={{
position: "sticky",
top: 0,
zIndex: 1,
"& .MuiTableCell-root": { backgroundColor: "background.paper" },
}}
> |
When the
stickyHeader
option is enabled on aTable
and the table contains multiple header rows, only the last of the rows ends up being sticky.Current Behavior 😯
Only the last of the header rows is sticky.
Expected Behavior 🤔
All header rows should be sticky.
Steps to Reproduce 🕹
https://codesandbox.io/s/ymv2c
The text was updated successfully, but these errors were encountered: