Skip to content
docsv0.3.0

DataTableRenderer

Tabular data view with headers, per-row cursor, vertical scrolling, optional row selection, and per-row action hints. Implements the table the spec COA §3.2 asks for (plugin list with columns Name / Status / Contracts / Action) as a pure node renderer. Layout: ┌──────────────────────────────────────────────────────────────┐ │ Name │ Status │ Contracts │ Action │ <- header row ├──────────────────────────────────────────────────────────────┤ │ BlogEngine │ ● active │ IBlog, ISecurity │ edit logs │ <- cursor row │ EcommerceCore │ ✕ error │ IPayment, ICur │ fix docs │ └──────────────────────────────────────────────────────────────┘ Column widths are derived from the declared `columns` (each may set `width` absolute or `flex` for proportional; default flex=1). The cursor row is marked with `›`; selected rows with `✓`. Vertical scrolling follows the cursor the same way as `SelectListRenderer`. Node props (all optional): - `columns` array `{key, label, width?, flex?, align?}|. - `rows` array Each row is `{id?, <colKey>: value, …}`; `id` is used for selection. - `cursor` int Index into the (filtered) row list. Default: 0. - `filter` string Substring filter (matches any cell). Default: ''. - `selected` array Row ids marked as selected. Default: []. - `caption` string Table title shown in the top border. Default: ''. - `showHeader` bool Show the header row. Default: true. - `actions` array Per-row action labels `{key, label}|; rendered in the last column. Default: []. - `focused` bool Override focus. Default: context.focused(). - `emptyText` string Message when no rows match. Default: 'No rows'.

DataTableRenderer::supports()

public function supports(Milpa\Live\ValueObjects\Tui\TuiNode $node): bool

True only for `data-table` nodes — dispatch is by declared node type, never by where the node came from.

Parameters

Parameters of supports()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode

DataTableRenderer::render()

public function render(Milpa\Live\ValueObjects\Tui\TuiNode $node, Milpa\Live\ValueObjects\Tui\TuiRenderContext $context): Milpa\Live\ValueObjects\Tui\TuiFrame

Draws the header, the visible slice of rows and the cursor marker. Column widths come from the declared `columns`; a row taller than the bounds scrolls rather than overflowing.

Parameters

Parameters of render()
NameTypeDescription
$nodeMilpa\Live\ValueObjects\Tui\TuiNode
$contextMilpa\Live\ValueObjects\Tui\TuiRenderContext