Skip to content
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

Sticky header row #71

Open
julian-scholz opened this issue Jun 3, 2022 · 4 comments
Open

Sticky header row #71

julian-scholz opened this issue Jun 3, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request need-help Resolving this issue is tricky and requires some help from the community.

Comments

@julian-scholz
Copy link

It would be very interesting if you could specify in the global table settings that the header rows can be sticky. Especially with larger data sets or more data sets per page, you otherwise have to constantly scroll upwards if you have many columns in a table.

@uap-universe uap-universe added the enhancement New feature or request label Jun 7, 2022
@uap-universe
Copy link
Collaborator

uap-universe commented Jun 7, 2022

If you mean by "sticky header" just adding position: sticky to header elements on demand, it looks like this could be done for the next milestone.

But maybe you try that out first. You can add the following to your stylesheet

angular2-smart-table thead th {
  position: sticky;
  top: 0;
}

and see if it has the desired effect. I guess it is a bit more complicated than that in the smart tables, because they have two header rows (the filters are also header elements).

You can also try to directly style the thead element. But rumors are that this does not (or did not) work in Chrome.

@julian-scholz
Copy link
Author

Exactly, that's roughly how I've already implemented it. Nevertheless, I would find it quite helpful if this option could be configured directly in the settings.
Especially if you also want to make the first columns (in my case the edit column) sticky, you also have to configure the respective z-indexes. Personally, I would find it cool if you could configure the entire column headings on the one hand and individual columns on the left-hand side to be sticky on the other.

@uap-universe
Copy link
Collaborator

Making the action column sticky is a bit more tedious and needs more careful testing, because 1) there could be a multi-select column before the action column and 2) you can choose the action column to be right instead of left.

But for the next milestone I will add the sticky flag for the table head.

@uap-universe uap-universe added this to the v2.4.0 milestone Jun 8, 2022
@uap-universe uap-universe self-assigned this Jun 8, 2022
@uap-universe
Copy link
Collaborator

Sorry @juulian98 - I have to remove this from the next milestone for now.

Sticky table stuff is still a complete mess... It simply does not work as expected (see the following screenshot).

image

You could fix the background issue by giving the cells an explicit background. But how can I know which background this is? What's with theming? Custom styles etc.?

Also I do not have a clue why the borders are disappearing when the header becomes sticky.

Apart from that, for sticky headers to work in a scrollable container, the scrollable container must be the direct parent of the table. So I had to hack a height attribute into this thing, because it is not sufficient to wrap a div arround with some height and overflow: auto.

I uploaded the current draft. Any ideas on how to make this thing work are more than welcome :)

@uap-universe uap-universe removed this from the v2.4.0 milestone Jun 9, 2022
@uap-universe uap-universe added the need-help Resolving this issue is tricky and requires some help from the community. label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request need-help Resolving this issue is tricky and requires some help from the community.
Projects
None yet
Development

No branches or pull requests

2 participants