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 sticky header support #17139
Conversation
Added link to ScrollableTable.js example
Then example code for scrollable table rows with a fixed header and toolbar.
ran prettier
Details of bundle changes.Comparing: 8ec0e6f...f95512e
|
Switch root height to 100% from 100vh
@egerardus Thanks for contributing, but I'm not sure I understand the purpose of this PR.
|
@mbrookes Thanks for your review. The only scrollable demo I saw was the virtualized table using the additional library dependency. In short terms: None of the demos covered any of my use cases fully, this demo would cover most of them:
To answer your points:
By "scrollable" I did not mean "infinite scrolling" which replaces paging entirely, I meant just scrollable as in the table can hold more than the 10 - 15 results that normally fits on desktop or mobile. In answering your points, I realize I am speaking from my own component use cases, though I do feel they are quite prevalent and common as shown with the two high-traffic sites noted above. Would it communicate better to call this demo a Simple Scrolling Table? With an introduction:
Essentially this is a demo for a simple scrollable table with fixed headers and a fixed bottom toolbar and without virtualization using just the standard MUI library. I could remove the paging toolbar if that violates any design maxims but I really feel it would be removing the most commonly used big data component, something that would be useful to have. It's also much easier to take something out of a demo than add it. |
Updated the title and information as noted in #17139 (comment)
Added wrapper to show properly on docs page.
revert
added table wrapper for demo
prettiered
@egerardus Hold on, what do you think of focusing on the fixed head problem? (#6625) |
Just a few commits later... Thanks again @mbrookes it's looking good now. Seemed to have an issue with the wrapper needed for the demos, here it is in Chrome v76: And here in Firefox v67: And here in Chrome for ipad: |
@egerardus Well done! |
@oliviertassinari agreed that adding the fixedHeader property is much better than a demo, I will see if I can carve out some time to delve into this. Though... the comments on #6625 that are in the vain of: "sticky head solution not working for me" offer no reproducible examples, so it could just be an implementation problem in which case a demo would be a useful answer for the immediate future. |
@egerardus Much better! |
The table border-collapse was set to "collapse"
Added class to prevent losing the header bottom border. Going to stop fiddling with this now...
@egerardus Ok, let me see if we can abstract some of the logic, also, I will try to simplify the demo to focus on the fixed header problem. |
@oliviertassinari OK sounds good |
@egerardus Could you have a look at the changes? Thanks! |
I have introduced a new prop to the table component. It sets the position sticky style and a few more. Unfortunately, it doesn't support IE 11. If vertical scrolling is not an issue, people can apply the same solution than the table pagination to the header. However, if they also want to support horizontal scrolling, something often required, and IE 11, then we would need to have a way different API. I believe that we would need to have something close to material-table, ag-grid, Telerik, antd, etc. |
So far, we have been focusing on the styles with the existing table components, in the future, I think that we should explore a higher-level API. The way ag-grid handle the community vs enterprise products is interesting: https://www.ag-grid.com/javascript-grid-set-license/. I think that we could do the same with a @material-ui/pro package and a new repository. We could even consider make the missing tree views feature as our first pro content (drag and drop, checkboxes) |
@oliviertassinari You're a wizard, I think it's great. I need to implement some grid components soon and would like to use material-ui for it. Depending on availability I will work toward doing a PR for higher level "grid" component when I have something stable together. |
@egerardus Thanks you for confirming the need for a table component that goes beyond handling the styles. The next steps ahead are unclear. Have you considered using material-table? |
@egerardus Thank you so much for this. Closing an important issue with the first PR 👍 |
@oliviertassinari I will check it out now, is the general idea to merge material-table into the core library at some point for this? If so that is what I would like to contribute to. |
I have no idea. I don't think that we should close any option until we focus on this problem/opportunity. |
Closes #6625
Added a scrollable table demo (scrollable rows with a fixed header and pagination toolbar) because it seems like a really common use case.