covalent icon indicating copy to clipboard operation
covalent copied to clipboard

Feature Request - Data Table: Fixed Header when scrolling

Open ishatd opened this issue 9 years ago • 12 comments

Need to have the option to have fixed headers on the data table so that they're visible when scrolling through rows.

ishatd avatar Apr 10 '17 15:04 ishatd

Playing around w/ an idea here: http://plnkr.co/edit/f8az0wGbhWsgCd0YnUI8?p=preview

I'm just using the flex layout to let the table rows fill the screen and keep the table headers and pagination "stuck" without using complex javascript positioning

flex-table

Obviously this will face challenges if there are more items in the page than a table, just wanted to test

kyleledbetter avatar Apr 12 '17 15:04 kyleledbetter

Also looking around the internet for existing solutions, here's a blog and repo for a sticky ng2 directive:

https://medium.com/@MikkelDamm/sticky-header-in-angular2-90364eba81d9

https://github.com/mikkeldamm/angular2-playground/tree/master/app

kyleledbetter avatar Apr 12 '17 15:04 kyleledbetter

This sticky directive has a nice demo https://rawgit.com/ng2-ui/ng2-sticky/master/app/index.html

kyleledbetter avatar Apr 12 '17 15:04 kyleledbetter

Seems like a duplicate of #341

In AngularJS projects I've used md-data-table (https://github.com/daniel-nagy/md-data-table) and have a pull request on fixed-table-header (https://github.com/daniel-nagy/fixed-table-header) to use $mdSticky from Material 1. @kyleledbetter , you may want to look at fixed-table-header for another idea on how to implement.

jraadt avatar Apr 18 '17 02:04 jraadt

thx @jraadt i've seen the fixed-table-header before and it's probably the most well done example for our use case, but fixed headers for in-page content are always such a janky double-scrollbar-inducing user experience. If a table truly has 100% width and height in a page I'm all for sticky headers and pagination, but we're going to keep debating this one

kyleledbetter avatar Apr 21 '17 16:04 kyleledbetter

@kyleledbetter I completely agree with the janky double-scrollbar experience. I never like to make the inside content of the table be scrollable with a fixed height on the header. Instead I'd recommend you keep the scroll with the page/container or whatever outside-the-table element currently is scrollable. It's just like having a long table on the scrollable page, but when you start scrolling down on the page when the header would normally disappear, it sticks to the top of the page until the entire table has scrolled past. Does that make sense? Keep the 1 scroll on the page (or outer container) and don't scroll inside the table.

jraadt avatar May 24 '17 14:05 jraadt

This is currently in the testing and internal usage phase since it goes hand in hand with virtual scrolling for a better performance.

emoralesb05 avatar Jun 15 '17 21:06 emoralesb05

Small preview of whats coming

virtual-scrolling-data-table

emoralesb05 avatar Jun 16 '17 22:06 emoralesb05

@emoralesb05 exciting, and it's in beta6 now?

zanecola avatar Aug 04 '17 02:08 zanecola

See link below. https://stackoverflow.com/questions/43455230/angular-material-fixed-table-header

rasoulMrz avatar Sep 06 '17 10:09 rasoulMrz

We're about to merge this feature for the next release https://github.com/Teradata/covalent/pull/859

kyleledbetter avatar Sep 07 '17 11:09 kyleledbetter

@kyleledbetter thx very much

zanecola avatar Sep 07 '17 13:09 zanecola