Tree Grid
Data Displayatlas-tree-gridExamples
File tree
Root rows in dataSource , children under children , a unique rowId across all levels. initiallyExpanded opens the roots on the first data, [(expandedKeys)] holds the open rows, and format writes a cell's text. Sort from a header, filter from its funnel button; with the keyboard, Right and Left open and close rows (WAI-ARIA treegrid).
src | Folder | 412 KB |
app | Folder | 268 KB |
main.ts | TypeScript | 2 KB |
docs | Folder | 96 KB |
README.md | Markdown | 18 KB |
package.json | JSON | 3 KB |
Open rows: src, docs
Search and hierarchy modes
Bind your own search box to search . filterHierarchy decides which relatives of a match stay: ancestors (the path to the root, the default), descendants (its subtree), both , or none . Rows kept only to show matches below them open on their own without changing expandedKeys ; collapsing one holds until the search changes.
Engineering | Ana Pop | 42 |
Platform | Radu Ionescu | 18 |
Billing services | Ioan Stan | 11 |
Finance | Vlad Matei | 9 |
Billing operations | Dana Lungu | 4 |
Selecting branches
selectionMode="multiple" adds a check box to the tree column; checking a row checks its descendants, and a row with only some of them checked shows a dash. [(selectedKeys)] holds the keys at every level, expanded or not. With the keyboard, Space selects the focused row.
Billing | Module |
View invoices | Read |
Issue refunds | Write |
Users | Module |
View members | Read |
Invite members | Write |
Remove members | Admin |
API
Generated from the library source, so it always matches the code.
AtlasTreeGridComponent atlas-tree-grid
| Input | Type | Default | Description |
|---|---|---|---|
| dataSource required | T[], T[] | null | undefined | — | null / undefined count as no rows. |
| columns required | TreeGridColumn<T>[] | — | |
| rowId required | string | ((row: T) => unknown) | — | |
| children | string | ((row: T) => readonly T[] | null | undefined) | 'children' | 'children' ) or a function. Missing = leaf. |
| treeColumn | string | null | null | |
| expandedKeys two-way | ReadonlySet<unknown> | new Set() | rowId ) of the expanded rows; two-way. Rows the filters open for you are not added. |
| initiallyExpanded | TreeGridInitialExpansion | 'none' | expandedKeys is still empty: 'none' , 'all' , or a depth ( 1 opens the roots, 2 also their children…). |
| sortable | boolean | true | sortable: false wins). Siblings are sorted at every level. |
| sort | SortState | null | null | |
| filterable | boolean | true | filterable: false wins). |
| filters | FilterState[] | [] | |
| search | string | '' | |
| filterHierarchy | GridTreeFilterMode | 'ancestors' | 'ancestors' : the path to the root. |
| selectionMode | TreeGridSelectionMode | 'none' | single selects the clicked row; multiple adds check boxes, and checking a row checks its descendants. |
| selectedKeys two-way | ReadonlySet<unknown> | new Set() | rowId ) of the selected rows, at any level and expanded or not; two-way. |
| dense | boolean | false | |
| striped | boolean | false | |
| maxHeight | string | null | undefined | undefined | 70vh , so a long tree scrolls inside the grid instead of scrolling the header off screen. null lets the grid grow with its rows (the page scrolls). |
| emptyText | string | '' | treeGrid.emptyText . |
| ariaLabel | string | undefined | undefined | treeGrid.ariaLabel . |
| locale | Partial<TreeGridLocale> | — | treeGrid ). |
| class | string | '' | cn() ; yours win on conflicts. |
| Output | Payload | Description |
|---|---|---|
| sortChange | TreeGridSortEvent | |
| filterChange | TreeGridFilterEvent | |
| rowClick | TreeGridRowClickEvent<T> | |
| selectionChange | TreeGridSelectionEvent<T> | clearSelection() . |
Types
TreeGridCellContext
cellTemplate .
| Property | Type | Description |
|---|---|---|
| $implicit | T | |
| value | unknown | |
| column | TreeGridColumn<T> | |
| level | number | |
| hasChildren | boolean | |
| expanded | boolean |
TreeGridColumn
atlas-tree-grid . It satisfies the grid engine's GridEngineColumn .
| Property | Type | Description |
|---|---|---|
| field | keyof T & string | |
| header | string | |
| type? | 'text' | 'number' | 'date' | 'number' and 'date' change how values compare, match filters and align. Default: text. |
| width? | string | '160px' . |
| align? | 'left' | 'center' | 'right' | 'right' . |
| sortable? | boolean | false turns sorting off for this column (when the grid is sortable ). |
| filterable? | boolean | false turns the Excel filter and the search off for this column (when the grid is filterable ). |
| filter? | { options?: GridFilterOption[] } | options replaces the computed value list. |
| format? | (value: unknown, row: T) => string | String(value) . |
| cellTemplate? | TemplateRef<TreeGridCellContext<T>> |
TreeGridFilterEvent
atlas-tree-grid filterChange .
| Property | Type | Description |
|---|---|---|
| filters | FilterState[] |
TreeGridInitialExpansion
initiallyExpanded opens: none, every row, or the rows down to a depth (1 = roots).
type TreeGridInitialExpansion = 'none' | 'all' | numberTreeGridRowClickEvent
atlas-tree-grid rowClick .
| Property | Type | Description |
|---|---|---|
| row | T | |
| level | number | |
| event | MouseEvent | KeyboardEvent |
TreeGridSelectionEvent
atlas-tree-grid selectionChange .
| Property | Type | Description |
|---|---|---|
| selected | T[] | |
| keys | ReadonlySet<unknown> | rowId ), the same set as selectedKeys . |
TreeGridSelectionMode
atlas-tree-grid selectionMode : no selection, one row, or several rows with checkboxes.
type TreeGridSelectionMode = 'none' | 'single' | 'multiple'TreeGridSortEvent
atlas-tree-grid sortChange .
| Property | Type | Description |
|---|---|---|
| sort | SortState | null |