pf_app
Go to file
Paul Trowbridge d2e706b483 SPIKE: per-branch column collapse without forking the plugin
Answers whether Excel-style column collapse — 2025 collapsed while 2026
stays expanded — can be had from our own code, given that the engine is
the one thing @perspective-dev ships as a binary.

It can, and the engine needs no change. Under split_rollup_mode 'rollup'
the engine already emits the whole column tree in pre-order: grand total,
then each branch's subtotal immediately followed by its own leaves. Every
number Excel would show is already on the client. What is missing is only
the ability to not show some of them, which is a DOM concern.

So branchCollapse.js hides the leaves of a collapsed branch from a style
listener on the regular-table, shrinks the spanning header cells to the
columns still showing under them, and makes the group headers clickable.
No fork, no engine change, ~150 lines.

Verified on an 8-column grid: collapse 2025 (8 -> 6 cells), also collapse
2026 (-> 3), expand 2025 while 2026 stays collapsed (-> 5), header row and
body stay width-aligned throughout, and the state survives a redraw the
plugin initiates itself (a sort change). Clicking the real header works,
not just the API.

Where it stops working, which is the point of the spike:

The plugin virtualises the column axis by fetching a CONTIGUOUS
[start_col, end_col) window from the view and indexing everything by that
x. Hiding cells inside that window does not make it fetch more. On the
same pivot with no filter — 101 engine columns, 20 rendered — collapsing
2025 leaves 2 of 21 rendered cells visible and the rest of the viewport
empty, because 2026's columns are outside the fetched window and nothing
tells the grid to widen it. Scroll right and it looks correct again.

So this is not a rendering bug to patch; collapse punches holes in the
axis rather than compacting it. It holds while the whole axis fits in one
fetched window (~20 columns at 1500px), and degrades past that. Fixing it
properly means the visible-index -> engine-index indirection a fork would
have to add anyway.

Not merged, and not suitable to ship as-is. Kept as the evidence for
choosing between forking viewer-datagrid and raising it upstream, where
nothing is currently in flight: zero open PRs, no branch, and no issue
asking for it, though split_rollup_mode itself landed only in PR #3211 on
2026-08-10.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LoxNi8cFsQLPUSw3obb5NH
2026-09-12 09:40:20 -04:00
lib Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
public Add UX mockup and update spec with navigation direction 2026-04-25 14:56:29 -04:00
routes Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
setup_sql Multi-slice operations, tagged bridge, and a reworked adjustment panel 2026-09-11 23:30:56 -04:00
ui SPIKE: per-branch column collapse without forking the plugin 2026-09-12 09:40:20 -04:00
.env.example Initial commit — pivot forecast application 2026-04-01 07:59:05 -04:00
.gitignore Scaffold React/Vite/Tailwind UI with 3-step Setup → Baseline → Forecast flow 2026-04-25 16:28:45 -04:00
CLAUDE.md Collapse the column hierarchy from the toolbar 2026-09-12 09:15:15 -04:00
install.sh Initial commit — pivot forecast application 2026-04-01 07:59:05 -04:00
package-lock.json Fix forecast data load and add byte-progress UI 2026-04-28 19:51:39 -04:00
package.json Add CLAUDE.md project instructions and license field to package.json 2026-05-02 20:47:15 -04:00
PERSPECTIVE.md Load Perspective from bundle, not CDN; pin all packages at 5.2.0 2026-08-17 21:30:19 -04:00
pf_perspective_options.md Record DuckDB virtual-server spike findings; choose display-grain pre-aggregation 2026-08-17 21:47:55 -04:00
pf_spec.md Merge perspective-inline-5.2.0: 5.2.0 pin, multi-slice ops, bridge, drag-select 2026-09-12 09:11:11 -04:00
pf.sh Add pf.sh — interactive deployment and service management script 2026-05-02 20:58:39 -04:00
server.js Fix forecast data load and add byte-progress UI 2026-04-28 19:51:39 -04:00