- Home
- Forum
- Angular - EJ 2
- Setting Hierarchy mode for TreeGrid
Setting Hierarchy mode for TreeGrid
I have this line of code:
this.treegridCompliance22.filterSettings.hierarchyMode = “Both”
That’s ok, but my problem is the treegrid in question is hidden initially so I can’t put it in OnInit. That’ll generate undefined errors since it doesn’t know what it is yet.
Is there a way to put that in here?
public treegridCompliance22: TreeGridComponent;
dataBoundCompliance22(args) {
Object.assign((this.treegridCompliance22.grid.filterModule as any).filterOperators, { startsWith: 'contains' });
}
Or otherwise include it in the treegrid definition?
<ejs-treegrid #treegridCompliance22 id='treegridCompliance22' [dataSource]='ticketsByComplianceLineItem'
[treeColumnIndex]='0' childMapping='subitems' width = '1400' height = '315' allowEditing= 'true'
[allowFiltering]='true' (dataBound)='dataBoundCompliance22()'
allowTextWrap='true' [textWrapSettings]='wrapSettings'
[allowExcelExport]='true'>
Such that it’ll set the hierarchy mode to “Both” even though the control is initially hidden?
Thanks
Query: Setting Hierarchy mode for TreeGrid
From your query, we suspect that you want to set the hierarchyMode on initial rendering but not on the onInit method. We achieved this requirement by using load events of the tree grid.
Please refer to the below code snippet,
|
<ejs-treegrid #treegrid [dataSource]='data' allowPaging='true' height='350' allowFiltering='true'
[pageSettings]='pageSettings' (load)="load()" childMapping='subtasks' [treeColumnIndex]='1'>
<e-columns>
App.component.ts
….
load() {
(this.treegrid as any).filterSettings.hierarchyMode = 'Both';
}
|
Please refer to the below sample,
https://stackblitz.com/edit/angular-jnrnn6?file=app.component.ts
Please refer to the below API documentation,
https://ej2.syncfusion.com/angular/documentation/api/treegrid/#load
Perfect!
Thanks very much
- 3 Replies
- 2 Participants
-
WC Walter Cook
- Jul 13, 2021 02:43 PM UTC
- Jul 15, 2021 12:46 PM UTC