-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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] Add input for sticky headers #5885
Comments
Using sticky position, interim solution has some bugs when you navigate through pages in a table, if you're not at the top of the table when you change the page, header disappear, any solution ? |
sticky position is not supported in IE. When will we see a cross-browser solution? |
Hello @andrewseguin, any solution to the problem related to the interim solution? |
You can use |
It's not really working on Firefox too, and in Chrome navigating or changing items per page cause bug. |
Support for position: sticky isn't great across browsers. |
For now, here's a fun solution. Separate your table into two - the first won't show any rows, and the second won't display the header. Make the overflow scroll only on the rows. If you set the same column IDs, you can re-use and existing column-specific class styles you might have applied (e.g. Proof-of-concept: Just realized this looks great on a mac, which overlays scrollbars rather than pushes content to show them. With this, scrollbars will push the rows left while the header is static, causing mis-alignment. |
@andrewseguin any suggestions on how to support horizontal + vertical scroll with sticky headers? So far I either get one or the other working properly. Here's the plunkr https://plnkr.co/edit/CXN6rNz3Kb9gDHKCceJ9?p=preview |
@andrewseguin While this works visually, I believe it has some accessibility issues. A screen reader is likely going to announce 2 tables, of which the second has hidden headers, so its not clear how a screen reader would handle it. |
Hi all and @jscharett ,
|
Support for sticky headers would be a really great feature! Really waiting for it :) |
I would love this feature as well !!! |
I had to do |
@simeyla can you share code? Where did you add |
@pantonis I did this in my styles.css You may need to look at the styles on the parent container if this doesn't work (eg. display or flex settings) - but this works quite nicely for me until there's an official update.
|
@simeyla Can you share how you reproduced the issue? I'm seeing this show up on Chrome dev tools when I enter responsive mode, but I can't seem to get a real world example on my Android phone and mac laptop |
Got it reproduced using this example https://stackblitz.com/edit/angular-s1t3nz?file=app/app.component.ts Seeing it on mobile chrome with desktop view showed an issue: https://angular-s1t3nz.stackblitz.io/ |
@andrewseguin What I posted was working quite well for me, so I was happy with this and wasn't really reporting an issue. But I'm only testing in latest Chrome at this time. If by issue you mean why did I have to use half a pixel it was on my iPad and showing through underneath the header as I scrolled. |
@simeyla , beautiful. works like a charm . thumbs up my css now has these two elements
|
@andrewseguin any update on sticky for mat header row. I tried the stickybits which works across browsers but doesn't seem to work for column headers. |
@kal93 Currently working on it right now. We're going the route of using Here's a stackblitz that I'm using to play with the idea: https://stackblitz.com/edit/angular-vttjfe?file=app%2Fhello.component.html |
Thanks much. |
@andrewseguin Creative, but filtering and sorting becomes an issue with this solution. This issue was opened in Jul 2017 - has there been any progress on scrolling just the body of the table? Looking for something exactly like the complex example here: https://v0.material-ui.com/#/components/table |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Add an input to
<cdk-table>
that makes the table's header stick to the top of the scroll container.Interim solution: Use styles
position: sticky; top: 0
on the header element.The text was updated successfully, but these errors were encountered: