Skip to content

freezing headers in the table component #683

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

Closed
lovasoa opened this issue Nov 10, 2024 Discussed in #682 · 4 comments
Closed

freezing headers in the table component #683

lovasoa opened this issue Nov 10, 2024 Discussed in #682 · 4 comments
Labels
enhancement New feature or request

Comments

@lovasoa
Copy link
Collaborator

lovasoa commented Nov 10, 2024

Discussed in #682

Originally posted by alexisrc1 November 9, 2024
It would be amazing for data analysis if there was a way to freeze columns and/or rows,so when tables become big it is easy to navigate them.
If you can add 2 two top-level parameters so we can indicate the numbers of rows / columns to freeze, for instance:

select
'table' as component,
2 as freeze_columns -- for freezing the first 2 columns of the table,
1 as freeze_rows -- for freezing the top row of the table (the row with columns names)
;
select
1 as a,
2 as b;
select
3 as a,
4 as b;

Thanks 😉

@lovasoa lovasoa added the enhancement New feature or request label Nov 10, 2024
@lovasoa
Copy link
Collaborator Author

lovasoa commented Nov 10, 2024

I just had a look at this. tabler has a built-in sticky header class, but it does not work with responsive tables.

https://tabler.io/docs/components/tables#table-with-sticky-header

Tables that can both scroll horizontally and have a sticky header are a pain in general

https://uxdesign.cc/position-stuck-96c9f55d9526

We may get to this eventually, but that would be a bigger effort than it seems.

@lovasoa
Copy link
Collaborator Author

lovasoa commented Nov 10, 2024

A workaround in the mean time is to fix the height of tables to make them vertically scrollable by including the following custom css:

thead {
  position: sticky;
}

.table-responsive {
  max-height: 50vh;
}

@lovasoa
Copy link
Collaborator Author

lovasoa commented Nov 10, 2024

And for horizontal scrolling:

th:first-child {
  position: sticky;
  left:0;
  z-index: 2;
}

td:first-child{
  position: sticky;
  left:0;
  background: var(--tblr-bg-surface-tertiary);
}
Screencast.From.2024-11-10.20-12-14.mp4

@lovasoa lovasoa changed the title freezing pans (justlike in Excel) for the tab component freezing headers in the table component Nov 10, 2024
@alexisrc1
Copy link
Contributor

thanks i'll try it out !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants