OGE logoOGE

Tree List API

Complete API reference for @oge-ui/tree-list. Columns, templates and configuration are shared with the grid — see the Data Grid API for <oge-column> and the option objects; this page documents the tree surface and the differences.

Properties Methods Events Types

OgeTreeList

oge-tree-list

Properties 33

Tree data

Name Type DefaultDescription
datareadonly T[] | DataSource&lt;T&gt;[]Flat self-referencing rows: a static array or any DataSource.
keyExprstring | ((row: T) =&gt; RowKey)'id'Row key: field path or selector (grid uses keyField).
parentIdExprstring | ((row: T) =&gt; unknown)'parentId'Parent reference: field path or selector.
rootValueunknownnullParent value marking root rows.
orphanPolicy'discard' | 'promoteToRoot''discard'Rows whose parent key is missing: drop or render as roots.
itemsExprstring | ((row: T) =&gt; readonly T[] | undefined) | undefined—Nested payloads: rows carry children inline (plain arrays only; parentIdExpr ignored).
hasItemsExprstring | ((row: T) =&gt; boolean) | undefined—Expandability hint for lazily loaded children.
loadMode'full' | 'lazy' | undefined—'lazy' fetches children per expansion (filter: [parentIdExpr,'=',key]); defaults to lazy with DataSource + hasItemsExpr.

Expansion & focus

Name Type DefaultDescription
autoExpandAllbooleanfalseExpands every row initially; the toggled-set polarity follows.
expandedRowKeysmodel&lt;readonly RowKey[]&gt;[]Two-way binding of the expanded row keys.
expandNodesOnFilteringbooleantrueAuto-expands ancestor chains of matches while a filter is active.
focusedRowEnabledbooleanfalseHighlights and tracks a single focused row.
focusedRowKeymodel&lt;RowKey | null&gt;nullTwo-way binding of the focused row's key.
autoNavigateToFocusedRowbooleanfalseA focusedRowKey change expands its ancestor path and scrolls (tree-only).

Selection

Name Type DefaultDescription
selectionModeOgeSelectionMode'none'none | single | multiple | checkbox.
selectedKeysmodel&lt;RowKey[]&gt;[]Two-way binding of the selected row keys.
selectionRecursivebooleanfalseTri-state cascade to descendants and ancestors.
allowSelectAllbooleantrueHides the header select-all checkbox when false.

Filtering & paging

Name Type DefaultDescription
filterRow / headerFilter / searchPanel / filterPanelboolean | optionsfalseSame options objects as the grid — all client-side over the loaded rows.
filterModeTreeFilterMode'withAncestors'Matches keep their ancestors; 'fullBranch' also keeps all descendants.
filterValuemodel&lt;FilterExpr | null&gt;nullTwo-way filter expression (builder).
filterDebouncenumber | undefined—Debounce for text filter inputs.
announcementsboolean | undefinedconfig.announcements (true)Speaks sort, filter/search result count (debounced, once the new result arrived), page, row expansion, select-all and blocked-save validation changes through the shared OgeLiveAnnouncer regions — texts from the *Announcement messages. false opts out.
pagingfalse | OgePagingOptionsfalsePages the visible (flattened) rows client-side; paging wins over virtualScroll.
summaryOgeTreeListSummary&lt;T&gt; | undefined—Aggregates (sum / avg / min / max / count / custom). totalItems render in a footer row over every row the filter leaves visible, at every level (collapsed branches included); recursiveItems show each parent its visible descendants’ aggregate beside its own value. Both are part of the Excel / PDF exports (total row, per-parent footer lines).
remoteOperationsOgeTreeListRemoteOperations | undefined—{ filtering: true } (full load mode) sends the filter row, header filter, builder filter and search text to the data source and asks source.distinct(field, { filter }) for header-filter values. Server contract: answer with every matching row plus all of its ancestors, flat, in the unfiltered shape; the tree renders the answer as-is (no client re-filtering) and opens the branches leading to the matches. Lazy trees keep their own remote match discovery.
sortable / sortingboolean | 'single' | 'multi' / OgeSortingOptionstrueSibling-scoped, multi-column by default.

Layout, editing & misc (grid-shared)

Name Type DefaultDescription
columnsreadonly (string | OgeColumnDef&lt;T&gt;)[] | undefined—Programmatic columns — the grid’s OgeColumnDef with every <oge-column> option; used when no declarative columns exist (and the way to share columns through a wrapper component).
virtualScroll / columnRenderingMode / rowHeight / overscan / columnMinWidthvarious—Virtualization knobs; columnRenderingMode is a top-level input here.
columnHidingMode'hide' | 'detail' | undefinedconfig: 'detail'What happens to columns responsive hiding (hidingPriority) takes out on a narrow grid: 'detail' gives every row a toggle (a real button with aria-expanded / aria-controls, labelled by toggleAdaptiveDetail) that reveals the hidden columns' caption / value pairs on a second line of the row, rendered like the cells — format, lookups, boolean words and cell templates; 'hide' drops them with no way back. The hiding pass counts the toggle's 32px track once a column is hidden.
columnResize / columnReorder / columnChooserboolean—Column UX (defaults: true/true/false), with the grid’s keyboard paths: Alt+←/→ resizes the focused header’s column (10px, Shift 1px) and its handle is a focusable role="separator"; Ctrl+Shift+←/→ moves it; Ctrl+↑/↓ moves a column-chooser item. Columns take the grid’s maxWidth.
editingfalse | OgeEditingOptionsfalsecell/row/batch/form/popup via the shared EditingModel.
commandButtons / rowDragging / rowAlternation / wordWrap / loadPanel / rtlEnabled / messages / stateKeyvarious—Same semantics as the grid; messages is the grid’s OgeGridMessages catalog — the reparenting handle reads reparentColumnHeader / reparentRow, boolean cells announce booleanTrueLabel / booleanFalseLabel. rowDragging keyboard: Ctrl+↑/↓ on a focused cell moves the row among its siblings, Ctrl+→ indents it under the previous sibling, Ctrl+← outdents it after its parent (logical in RTL) — the same drop path and reparent event as a handle drag, announced via messages.treeRowMoved.

Methods 19

Tree navigation & data

Name Type Description
expandAll() / collapseAll()voidPolarity-aware over the expandable keys.
expandRow(key) / collapseRow(key) / isRowExpanded(key)void / booleanPer-row expansion (imperative API bypasses the cancelable events).
focusRow(key) / navigateToRow(key)voidExpands the ancestor path, scrolls to the row and focuses its first cell.
scrollToRow(target: number | RowKey)voidScrolls a visible row into the viewport.
getNodeByKey(key): T | undefinedT | undefinedThe loaded row carrying key.
forEachNode(callback)voidRuns the callback for every loaded row with (row, key, parentKey).
getVisibleRows(): readonly T[]readonly T[]Data rows of the rendered page, in display order.
refresh(): voidvoidRe-runs the load and drops lazily fetched rows.

Selection

Name Type Description
getSelectedRowKeys(mode = 'all')RowKey[]'all' | 'leavesOnly' | 'excludeRecursive' narrows recursive selections.
getSelectedRowsData(mode = 'all')T[]Row data per the same modes.
selectAll() / deselectAll() / clearSelection() / isRowSelected(key)void / booleanRecursive mode cascades select-all to descendants.
copyToClipboard(): Promise&lt;void&gt;Promise&lt;void&gt;Selected rows as tab-separated values (with header).

Editing, paging, state & export

Name Type Description
addRow(parentKey?)voidNew unsaved row; parent pre-staged with a string parentIdExpr; initNewRow can prefill.
editRow(key) / deleteRow(key) / saveChanges() / discardChanges() / hasChanges()void / booleanSame semantics as the grid.
pageIndex / setPageIndex(i) / pageSize() / setPageSize(n) / pageCount() / totalCount()signal / methodspageIndex is a writable signal; totalCount() spans all pages.
beginCustomLoading(message?) / endCustomLoading()voidLoad panel independent of data activity.
state() / applyState(snapshot)TreeListStateSnapshot / voidSort, filters, column layout and expansion. applyState validates the snapshot first (sanitize*StateSnapshot): unknown keys are dropped, prototype keys rejected, wrong types skipped — invalid input is ignored, never thrown.
clearFilters() / clearSorting()voidReset the view.
getExportData(options?) / getCsv() / exportCsv()syncSynchronous (grid: async). getExportData takes OgeTreeExportOptions (visibleColumnsOnly, selectedRowsOnly, summaries) and returns rows, levels and the summary lines; CSV indents the first column 2 spaces per level; the Excel entry sets real outline levels. Cells a spreadsheet would evaluate as a formula are apostrophe-prefixed (CSV formula injection); formulaGuard: false opts out.

Events 10

Tree-specific

Name Type Description
rowExpanding / rowCollapsingOgeTreeRowTogglingEvent&lt;T&gt;Cancelable — UI-driven toggles only (the imperative API stays silent).
rowExpanded / rowCollapsedOgeTreeRowToggleEvent&lt;T&gt;{ key, row } after a toggle.
rowReparentedOgeTreeRowReparentEvent&lt;T&gt;Drag & drop: { key, row, fromParentKey, toParentKey, position: 'inside' | 'before' | 'after' }.
initNewRowOgeTreeInitNewRowEvent{ key, parentKey, values } prefill hook.

Shared with the grid

Name Type Description
rowClick / rowDblClick / cellClick / cellDblClickOgeRowClickEvent / OgeCellClickEventFlat payloads with the originating DOM event.
rowContextMenu / headerContextMenucontext-menu eventsMutable items; also opened by the Menu key / Shift+F10 on a focused cell or header (source: 'keyboard', anchored at the cell).
selectionChanged / focusedRowChangeddiff / focus eventsSame payloads as the grid.
editingStart / rowInserting / rowInserted / rowUpdating / rowUpdated / rowRemoving / rowRemoved / savingChanges / savedChanges / editCanceledediting lifecycleSame shared EditingModel pipeline as the grid; -ing events cancelable.
expandedRowKeysChange / selectedKeysChange / focusedRowKeyChange / filterValueChangemodel change eventsThe change halves of the [(expandedRowKeys)], [(selectedKeys)], [(focusedRowKey)] and [(filterValue)] two-way bindings.
exporting / dataErrorOccurred / contentReady / stateChangemiscSame semantics as the grid (stateChange carries a TreeListStateSnapshot).

Types 10

Name Type Description
OgeTreeDropPosition'inside' | 'before' | 'after'Reparent vs sibling ordering.
OgeTreeExportData&lt;T&gt;OgeExportData&lt;T&gt; &amp; { levels: readonly number[] }Zero-based depth per exported row (drives spreadsheet outline levels).
TreeFilterMode'withAncestors' | 'fullBranch'Visible set under a filter.
exportOgeTreeListToExcel(treeList, options?)@oge-ui/tree-list/export-excelLazy Excel export with native outline grouping, the total row and per-parent summary rows (values or SUBTOTAL formulas), grid widths, freeze panes and the grid exporters’ styles.
OgeTreeListSummary&lt;T&gt; / OgeTreeSummaryItem{ totalItems?; recursiveItems?; calculateCustomSummary? } / { field; type; name?; showInColumn? }The summary input: items aggregate field with a SummaryType; custom runs calculateCustomSummary[name ?? field](rows, field); showInColumn moves the value under another column.
OgeTreeListRemoteOperations{ filtering?: boolean }What the tree hands to its data source (see remoteOperations for the server contract).
OgeTreeExportOptions{ visibleColumnsOnly?; selectedRowsOnly?; summaries? }What getExportData() and both export entries include.
exportOgeTreeListToPdf(treeList, options?)@oge-ui/tree-list/export-pdfLazy PDF export (optional jspdf + jspdf-autotable peers): hierarchy as first-column indentation, the header repeated on every page, total and per-parent summary rows, grid widths fitted to the page, title, pageHeader / pageFooter, pageNumbers. buildTreePdfDocument(data, options) for custom pipelines. Text outside WinAnsi (Turkish ğ ş ı İ, Central European, Greek, Cyrillic) needs a Unicode TrueType font — per export, or once for every PDF via setOgePdfDefaultFont({ family, normal, bold }) from @oge-ui/behavior; without one the built-in Helvetica cannot draw it (a dev-mode warning says so).
OgeTreeExcelExportOptions&lt;T&gt; / OgeTreePdfExportOptions&lt;T&gt;interfacesThe tree download helpers’ options — the grid exporters’ options (styles, formats, freeze panes, summaryFormulas, page chrome) minus grouping.
Re-exportsfrom @oge-ui/gridOgeColumn, templates, config/messages and the shared event payload types are re-exported so tree-only consumers have a single import source.

Notes

  • Key differences from the grid: keyExpr instead of keyField, synchronous export methods, no grouping/master detail, and the extra tree inputs/events documented above.
  • expandRow()/collapseRow() are polarity-aware under autoExpandAll and do not fire the cancelable rowExpanding/rowCollapsing events — those veto UI-driven toggles only.