-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Feature Request
Add a fixed_bottom_rows reactive attribute to DataTable, analogous to the existing fixed_rows (which pins rows to the top).
Motivation
fixed_rows is great for keeping header-like rows visible while scrolling, but there's no equivalent for pinning rows to the bottom of the table. This is a common need for summary/totals/workload rows that should always remain visible regardless of vertical scroll position.
Use case
I'm building a Gantt chart with a workload summary row at the bottom. Currently this row scrolls off-screen when there are many tasks. I'd like it to stay pinned at the bottom, just as date headers stay pinned at the top via fixed_rows.
Workarounds considered
- Splitting into two DataTables (main + footer): column widths can be matched, but horizontal scroll becomes independent between the two tables, so the timeline columns get out of sync.
- Syncing
scroll_xbetween two tables viawatch: introduces visual lag and feels hacky. - Placing the summary row at the top with
fixed_rows: semantically wrong for a totals/summary row.
None of these are satisfactory.
Proposed API
table = DataTable()
table.fixed_rows = 3 # existing: pin first 3 rows to top
table.fixed_bottom_rows = 1 # new: pin last 1 row to bottomThe fixed_bottom_rows attribute would:
- Keep the last N rows visible at the bottom of the scrollable area
- Apply the existing
datatable--fixedcomponent style (or a newdatatable--fixed-bottomstyle) - Work independently of
fixed_rows
Implementation notes
The rendering logic in _get_fixed_offset and render_line would need to account for bottom-fixed rows:
- Calculate the height occupied by bottom-fixed rows
- Exclude them from the scrollable region
- Render them at the bottom of the visible area
This mirrors how fixed_rows works for the top, applied symmetrically to the bottom.