-
-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(table): all scroll stuck head foot first last variant
This PR adds a stuck variant which supports to have the head, foot, first column and last column of a table being stuck while scrolling (using position sticky) You can freely stick any combination like head first stuck, foot first last stuck, head foot first stuck, first last stuck, etc. This feature needs to have the table being wrapped by a overflowing container having a fixed height (and/or optional width). That said, i also added a new scrolling container and scrolling segment variant, which can be used for that purpose. Why stuck instead of sticky or fixed? Because the other classnames already exists and provide different functionality Why not use classnames "header, footer, top, bottom, left, right" ? Because the other classnames (beside "footer") already exists and provide different functionality What about the already merged scrolling table #2134 ? Why another approach? Unfortunately the other approach cannot properly support having the first or last column fixed (I tried some very ugly approaches which needed a fixed width of the columns and especially were not able to fill the background color into the whole cell.) The new stuck variant makes use of sticky positioning which supports using a usual table element and does not have the above mentioned issues. The scrolling table works in any browser, while stuck needs modern browsers with position:sticky support to table elements . stuck possibly needs a wrapper when horizontal scrolling is not needed, while scrolling does not. That said, i also added new scrolling container and scrolling segment variants, which can be used for that purpose. If you don't want to have an extra wrapper, you can use overflowing stuck table. However, this only works if your overall table columns exceed available width. Each new variant of scrolling container, scrolling segment or overflowing table support predefined heights using short, very short, long and very long See comparison table for details. Comparison Feature stuck table scrolling table Supports fixed thead ✔️ ✔️ Supports fixed tfoot ✔️ ✔️ Supports fixed left column ✔️ Supports fixed right column ✔️ Supports combinations ✔️ Supports column sizing (wide)1 ✔️ Supports (single line) ✔️ Supports vertical scrolling ✔️ ✔️ Supports horizontal scrolling ✔️ Needs wrapper2 ✔️ Needs modern browser ✔️ Scrollbar only for tbody ✔️
- Loading branch information
Showing
7 changed files
with
531 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.