Skip to content

feat: add use_freeze_tables() to freeze table headers and first columns - #51

Merged
kpagacz merged 3 commits into
mainfrom
feat/freeze-tables
Oct 14, 2026
Merged

kpagacz merged 3 commits into
mainfrom
feat/freeze-tables

Conversation

@kpagacz

@kpagacz kpagacz commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

Closes #30

Adds use_freeze_tables(), which returns a tagList to include once in the app UI (e.g. teal::init(header = ...)). It makes the header rows and/or the first column of teal.widgets tables sticky.

  • rtables renders no <thead>, so a small MutationObserver script moves the leading <th> rows into a <thead> (see Add <thead> and <tbody> tags into output of as_html pharmaverse/rtables#1123).
  • module_ids limits freezing to tables inside elements whose id contains any of the given strings.
  • Tables use border-collapse: separate. With collapsed borders, Chromium paints the scrolled body text over the sticky header.
  • Based on a solution from a colleague. Changes from that version: fixed broken JS quoting when module_ids is used (selectors are now JSON-encoded), added argument checks, used --bs-body-bg for sticky backgrounds, removed empty <tbody> elements left after the restructure, and added tests and an example.

Verified in headless Chrome with the tm_t_summary example: the header stays visible when scrolling vertically, the first column stays visible when scrolling horizontally, and the corner cell stays on top of both.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

badge

Code Coverage Summary

Filename                                     Stmts    Miss  Cover    Missing
-----------------------------------------  -------  ------  -------  ---------
R/BlockConditions.R                             21      21  0.00%    23-61
R/create_rel_risk_transformator.R               42      42  0.00%    41-87
R/forest_plot_decorator.R                      164     164  0.00%    97-373
R/freeze_tables.R                              103     103  0.00%    57-166
R/ggplot_decorator.R                           245     245  0.00%    105-376
R/merge_levels_transformator.R                 146     146  0.00%    11-240
R/or_filtering_transformator_view_model.R       27      27  0.00%    25-61
R/or_filtering_transformator.R                 282     282  0.00%    69-397
R/patchwork_plot_decorator.R                    46      46  0.00%    18-68
R/r_access_utilities.R                          46      46  0.00%    32-152
R/ReportManager.R                              401     401  0.00%    41-743
R/title_footer_decorator.R                     142     142  0.00%    105-254
R/tm_report_manager.R                          719     719  0.00%    31-896
R/watermark_decorator.R                         61      61  0.00%    23-87
TOTAL                                         2445    2445  0.00%

Diff against main

Filename             Stmts    Miss  Cover
-----------------  -------  ------  --------
R/freeze_tables.R     +103    +103  +100.00%
TOTAL                 +103    +103  +100.00%

Results for commit: 87dc98b

Minimum allowed coverage is 80%

♻️ This comment has been updated with latest results

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kpagacz
kpagacz merged commit 6cb26fe into main Oct 14, 2026
23 checks passed
@kpagacz
kpagacz deleted the feat/freeze-tables branch October 14, 2026 14:35
@nikolas-burkoff

Copy link
Copy Markdown

@donyunardi may be of interest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Freeze panes (lock rows/columns) shiny module

2 participants