Tree View

April 28, 2026 · View on GitHub

Display hierarchical data with collapsible parent/child rows.

Data Shape

Nest child rows under a configurable property (default: children):

const treeData = [
  {
    name: 'Engineering',
    headcount: 42,
    children: [
      { name: 'Frontend', headcount: 18 },
      { name: 'Backend', headcount: 24 },
    ],
  },
];

const gridOptions: GridOptions = {
  id: 'org-tree',
  data: treeData,
  enableTreeView: true,
  treeChildrenField: 'children',
  treeIndent: 20,
  columnDefs: [
    { name: 'name' },
    { name: 'headcount', type: 'number' },
  ],
};

Options

OptionTypeDefaultDescription
enableTreeViewbooleanfalseEnable tree mode
treeChildrenFieldstring'children'Property name for child array
treeIndentnumber10Pixels per indent level
showTreeExpandNoChildrenbooleantrueShow toggle for childless rows
treeRowHeaderAlwaysVisiblebooleanfalseAlways show expand column

Filtering

When a filter is active, child matches bubble up — parent rows are shown even when they don't match the filter, as long as at least one child does.

API

MethodDescription
gridApi.treeBase.toggleRowTreeState(row)Toggle node expansion
gridApi.treeBase.expandRow(row)Expand a node
gridApi.treeBase.collapseRow(row)Collapse a node
gridApi.treeBase.expandAllRows()Expand all nodes
gridApi.treeBase.collapseAllRows()Collapse all nodes
gridApi.treeBase.getRowChildren(row)Get child GridRow objects
gridApi.treeView.getTreeView()Get current expansion state map
gridApi.treeView.setTreeView(state)Bulk set expansion state

Tree View vs Grouping

Tree ViewRow Grouping
Data sourcePre-structured with children arrayFlat data — groups created dynamically
NestingYour data defines the hierarchyGrid creates groups from column values
Mutual exclusivityDisables grouping when activeDisables tree view when active