jatui

createRowWindow

Headless variable-height windowing (spacer rows, so it works in a <table>): sticky group headers, pinned keys, threshold, auto scroll root

Variable-height rows in a real <table>

Rows have 1–4 lines of text, and clicking a row adds four more. Each row is measured as it renders. The project and epic headers stick at two levels, and the active one of each stays rendered after it scrolls out of the slice. T-0042 is pinned, standing in for an open inline editor, so it never unmounts. The scroll root is 'auto', which finds the bordered box below.

rendered 24 of 5120 · windowed true · total 263840px

IDTitleStatusEst
project-1 · 250
epic 1.1 · 50
T-0000
windowing windowing task
windowing measures every rendered row and corrects the scroll
in_progress1h
T-0001
measures the task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a
open8h
T-0002
every the task
windowing measures every rendered row and corrects the scroll
open1h
T-0003
rendered while task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the position when a row above the viewport changes height
blocked4h
T-0004
row row task
windowing measures every rendered row and corrects the scroll
review4h
T-0005
and a task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a
review1h
T-0006
corrects so task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a
blocked1h
T-0007
the measures task
windowing measures every rendered row and corrects the scroll
blocked6h
T-0008
scroll scroll task
windowing measures every rendered row and corrects the scroll
blocked7h
T-0009
position viewport task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
review8h
T-0010
when you task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the position when a row above the viewport changes height
blocked5h
T-0011
a and task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the position when a row above the viewport changes height
in_progress6h
T-0012
row row task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
open6h
T-0013
above nothing task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
blocked8h
T-0014
the every task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
open5h
T-0015
viewport position task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the position when a row above the viewport changes height
open3h
T-0016
changes changes task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
blocked1h
T-0017
height read task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a
review6h
T-0018
so corrects task
windowing measures every rendered row and corrects the scroll
open2h
T-0019
nothing above task
windowing measures every rendered row and corrects the scroll rendered row and corrects the scroll position when a corrects the scroll position when a row above the
review1h
T-0020
jumps jumps task
windowing measures every rendered row and corrects the scroll
open5h
T-0042
so corrects task
windowing measures every rendered row and corrects the scroll
blocked5h

Usage

import { createRowWindow } from '@joewinke/jatui/virtual' // peer: @tanstack/virtual-core

const win = createRowWindow({
  count: () => rows.length,
  getKey: (i) => rows[i].id,
  estimateSize: () => 44,
  stickyIndices: () => [projectHeaderIdx, epicHeaderIdx], // one array per level
  pinned: () => [editingId],
  threshold: 40,          // render everything below 40 items
  scrollRoot: 'auto',     // nearest ancestor that really scrolls, else window
})

<tbody use:win.anchor>
  <tr style:height="{win.paddingTop}px" />
  {#each win.items as item (item.key)}
    {#if item.gapBefore}<tr style:height="{item.gapBefore}px" />{/if}
    <tr use:win.measure={item.key}>…rows[item.index]…</tr>
  {/each}
  <tr style:height="{win.paddingBottom}px" />
</tbody>