Angular UI Components Documentation
The Angular TreeGrid represents data in a tree-like structure. This guide adds the Angular TreeGrid (jqxTreeGrid) to an app, then shows how to set its options, handle its events and call its methods.
jqwidgets-ngjqwidgets-ng/jqxtreegrid 
In an Angular project (to start one, see Getting started with Angular), add the package with the Angular CLI. It asks for a theme and adds the styles to angular.json:
ng add jqwidgets-ng
Components are standalone: add jqxTreeGridModule to the imports of the component that uses it.
import { Component } from '@angular/core';
import { jqxTreeGridModule } from 'jqwidgets-ng/jqxtreegrid';
@Component({
selector: 'app-root',
imports: [jqxTreeGridModule],
templateUrl: './app.html'
})
export class App {}
The source of the live JSON Data demo.
<jqxTreeGrid
[width]="getWidth()"
[source]="dataAdapter"
[pageable]="true"
[sortable]="true"
[columns]="columns"
[columnGroups]="columnGroups"
[ready]="ready"
#TreeGrid>
</jqxTreeGrid>
import { Component, viewChild } from '@angular/core';
import { jqxTreeGridComponent } from 'jqwidgets-ng/jqxtreegrid';
import { CommonModule } from '@angular/common';
import { jqxTreeGridModule } from 'jqwidgets-ng/jqxtreegrid';
@Component({
imports: [CommonModule, jqxTreeGridModule],
selector: 'app-root',
templateUrl: './app.html'
})
export class App {
readonly treeGrid = viewChild.required<jqxTreeGridComponent>('TreeGrid');
getWidth(): any {
if (document.body.offsetWidth < 850) {
return '90%';
}
return 850;
}
employees: any[] = [
{
EmployeeID: 1,
FirstName: 'Nancy',
LastName: 'Davolio',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2024-04-26 00:00:00',
BirthDate: '1980-12-03 00:00:00',
City: 'Seattle',
Address: '507 - 20th Ave. E.Apt. 2A'
},
{
EmployeeID: 2,
FirstName: 'Andrew',
LastName: 'Fuller',
ReportsTo: null,
Country: 'USA',
Title: 'Vice President, Sales',
HireDate: '2024-08-09 00:00:00',
BirthDate: '1984-02-14 00:00:00',
City: 'Tacoma',
Address: '908 W. Capital Way'
},
{
EmployeeID: 3,
FirstName: 'Janet',
LastName: 'Leverling',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2024-03-27 00:00:00',
BirthDate: '1995-08-25 00:00:00',
City: 'Kirkland',
Address: '722 Moss Bay Blvd.'
},
{
EmployeeID: 4,
FirstName: 'Margaret',
LastName: 'Peacock',
ReportsTo: 2,
Country: 'USA',
Title: 'Sales Representative',
HireDate: '2025-04-28 00:00:00',
BirthDate: '1969-09-14 00:00:00',
City: 'Redmond',
Address: '4110 Old Redmond Rd.'
},
{
EmployeeID: 5,
FirstName: 'Steven',
LastName: 'Buchanan',
ReportsTo: 2,
Country: 'UK',
Title: 'Sales Manager',
HireDate: '2025-10-12 00:00:00',
BirthDate: '1987-02-27 00:00:00',
City: 'London',
Address: '14 Garrett Hill'
},
{
EmployeeID: 6,
FirstName: 'Michael',
LastName: 'Suyama',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2025-10-12 00:00:00',
BirthDate: '1995-06-27 00:00:00',
City: 'London',
Address: 'Coventry House Miner Rd.'
},
{
EmployeeID: 7,
FirstName: 'Robert',
LastName: 'King',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2025-12-28 00:00:00',
BirthDate: '1992-05-24 00:00:00',
City: 'London',
Address: 'Edgeham Hollow Winchester Way'
},
{
EmployeeID: 8,
FirstName: 'Laura',
LastName: 'Callahan',
ReportsTo: 2,
Country: 'USA',
Title: 'Inside Sales Coordinator',
HireDate: '2026-02-28 00:00:00',
BirthDate: '1990-01-04 00:00:00',
City: 'Seattle',
Address: '4726 - 11th Ave. N.E.'
},
{
EmployeeID: 9,
FirstName: 'Anne',
LastName: 'Dodsworth',
ReportsTo: 5,
Country: 'UK',
Title: 'Sales Representative',
HireDate: '2026-11-10 00:00:00',
BirthDate: '1998-01-22 00:00:00',
City: 'London',
Address: '7 Houndstooth Rd.'
}
];
source: any = {
dataType: 'json',
dataFields: [
{ name: 'EmployeeID', type: 'number' },
{ name: 'ReportsTo', type: 'number' },
{ name: 'FirstName', type: 'string' },
{ name: 'LastName', type: 'string' },
{ name: 'Country', type: 'string' },
{ name: 'City', type: 'string' },
{ name: 'Address', type: 'string' },
{ name: 'Title', type: 'string' },
{ name: 'HireDate', type: 'date' },
{ name: 'BirthDate', type: 'date' }
],
hierarchy: { keyDataField: { name: 'EmployeeID' }, parentDataField: { name: 'ReportsTo' } },
id: 'EmployeeID',
localData: this.employees
};
dataAdapter: any = new jqx.dataAdapter(this.source);
columns: any[] = [
{ text: 'FirstName', columnGroup: 'Name', dataField: 'FirstName', width: 200 },
{ text: 'LastName', columnGroup: 'Name', dataField: 'LastName', width: 200 },
{ text: 'Title', dataField: 'Title', width: 160 },
{ text: 'Birth Date', dataField: 'BirthDate', cellsFormat: 'd', width: 120 },
{ text: 'Hire Date', dataField: 'HireDate', cellsFormat: 'd', width: 120 },
{ text: 'Address', dataField: 'Address', width: 250 },
{ text: 'City', dataField: 'City', width: 120 },
{ text: 'Country', dataField: 'Country' }
];
columnGroups: any[] = [{ text: 'Name', name: 'Name' }];
ready = (): void => {
this.treeGrid().expandRow(2);
};
}Options are inputs, bound with [name]="value".
Events are outputs named on plus the event name with a capital first letter. For example, bindingComplete: This event is triggered when the jqxTreeGrid binding is completed.
<jqxTreeGrid (onBindingComplete)="onBindingComplete($event)"></jqxTreeGrid>
onBindingComplete(event: any): void {
console.log(event.args);
}
Get the component with a signal query and call its methods. For example, refresh: Performs a layout and updates the HTML elements position and size.
<jqxTreeGrid #myTreeGrid></jqxTreeGrid>
import { Component, viewChild } from '@angular/core';
import { jqxTreeGridModule, jqxTreeGridComponent } from 'jqwidgets-ng/jqxtreegrid';
@Component({
selector: 'app-root',
imports: [jqxTreeGridModule],
templateUrl: './app.html'
})
export class App {
readonly myTreeGrid = viewChild.required<jqxTreeGridComponent>('myTreeGrid');
run(): void {
this.myTreeGrid().refresh();
}
}