A simple way to specify a generic tree column #127
Replies: 3 comments
-
After implementing a functional sparse tree as part of #19, it is now much clearer to me what is needed in a generic tree API. Here's my proposal for an API that is both reasonably clean and straightforward to implement: Currently, interface IRowIndex {
values: string[][];
name?: string;
treeFuncs?: ITreeFuncs;
}
interface ITreeFuncs {
collapse: (rix: number) => void;
expand: (rix: number) => void;
is_leaf: (rix: number) => boolean;
set_depth?: (rix: number) => void;
} where Notes:
@texodus Does this seem reasonable to you? Is there anything missing here that would be critical to the dense tree case (eg a perspective grid with |
Beta Was this translation helpful? Give feedback.
-
Some simpler (but problematic) alternative proposals:
|
Beta Was this translation helpful? Give feedback.
-
@telamonian should we close this now that |
Beta Was this translation helpful? Give feedback.
-
I've been messing around with the tree functionality in regular-table. The existing tree support is based on
row_pivots
, which is cumbersome for specifying a generic tree whose complete structure you don't necessarily know in advance. I think(?) there may also be at least some trees that you can't specify in terms of row pivots.So far my best idea is that if a row can be expanded, the user's data model should add a
/
to the end of its final path element, and also supplyexpand
andcollapse
functions (as per_on_toggle
).I'm working on a branch right now to implement the above, but am absolutely open to more clever suggestions.
Beta Was this translation helpful? Give feedback.
All reactions