<button ejs-button (click)="expandAll()">Expand All nodes</button>
<button ejs-button (click)="collapseAll()">Collapse All nodes</button>
public expandAll()
{
this.treeObj.expandAll();
}
public collapseAll()
{
this.treeObj.collapseAll();
} |
|
<ejs-treeview #default id="default" fields='field'></ejs-treeview>
Here, #default is the template reference used to access TreeView component using ViewChild |
import { ViewChild }
from '@angular/core';
@ViewChild('default') // 'default' is the Template reference defined for TreeView in html page public treeObj: TreeViewComponent; //Now you can access tree instance like below, ngOnInit() { this.treeObj.expandedNodes = ['03']; }
|