esvit / ng-table

Simple table with sorting and filtering on AngularJS
http://esvit.github.io/ng-table
BSD 3-Clause "New" or "Revised" License
2.77k stars 851 forks source link

Fixed header #524

Open samyomar opened 9 years ago

samyomar commented 9 years ago

the ability to add fixed header will be very good

christianacca commented 9 years ago

Maybe this can be achieved using just css?

A quick look on SO:

c-eliasson commented 9 years ago

@christianacca For vertical scrolling, it would be an easy fix with CSS using overflow-y: auto; on the tbody. For horizontal scrolling on the other hand, is it a whole different story.

For horizontal scrolling, you cannot do it with pure CSS, from what I know. The problem is that the columns in the thead would not scroll along with the columns in tbody. To solve that, I've seen some jQuery plugins that brake the table into two separate tables, one containing the thead and one containing tbody and then they scroll both tables simultaneously using javascript.

RohitUdayTalwalkar commented 9 years ago

@c-eliasson - I'm having some trouble with your suggestion, the table headers are still scrolling even with that style applied to the body. Any chance you've got an example I can look at?

c-eliasson commented 9 years ago

@RohitUdayTalwalkar You would probably have to set display: block; on the tbody as well.

Example

RohitUdayTalwalkar commented 9 years ago

@c-eliasson https://github.com/c-eliasson Great, that works! The width doesn't match the header but I think I can write a directive to get that working.

Thanks for the quick response!

-Rohit

On Mon, Mar 9, 2015 at 1:46 PM, Christofer Eliasson < notifications@github.com> wrote:

@RohitUdayTalwalkar https://github.com/RohitUdayTalwalkar You would probably have to set display: block; on the tbody as well.

Example https://jsfiddle.net/6wsds9rn/

— Reply to this email directly or view it on GitHub https://github.com/esvit/ng-table/issues/524#issuecomment-77938524.

anthony-o commented 8 years ago

One can be inspired by this SO question and perhaps by one of those github projects:

theaspect commented 8 years ago

See https://github.com/esvit/ng-table/issues/41#issuecomment-253237169