Hi lorryl,
Greetings from Syncfusion Support.
Query#:- treeColumnIndex not consider the front column
that visible is false?
By default, treeColumnIndex will be shown by considering
visible columns which is behavior in TreeGrid. However,to achieve your
requirement, we have dynamically change the TreeColumnIndex based on
specific condition(based on visibility) using dataBound event of the
TreeGrid.
Refer to the code below:-
App.Component.html:-
<ejs-treegrid #treegrid
[dataSource]="data"
childMapping="subtasks"
height="350"
[treeColumnIndex]="1"
[allowPaging]="true"
[pageSettings]="pageSettings"
(dataBound)="DataBound($event)">
<e-columns>
<e-column field="duration"
headerText="Duration"
width="80"
[visible]="false"
textAlign="Right"></e-column>
</e-columns>
</ejs-treegrid>
App.Component.ts:-
DataBound(args)
{
var col = (this.treegrid as any).columns;
var inx = col.findIndex((x)
=> x.field == 'taskName');
this.treegrid.treeColumnIndex
= inx; //change treeColumn based on your customized condition
}
|
App.Component.ts
DataBound(args) {
var col = (this.treegrid as any).columns;
if (col[0].visible == false)
{
this.treegrid.treeColumnIndex
= 2; //change
treeColumn based visibility on first column
}
}
|
Note:- Please use either of the
above-mentioned workarounds to dynamically change the treeColumnIndex.
Sample link for reference:- https://stackblitz.com/edit/angular-5odv69?file=src%2Fapp.component.html
API link:- https://ej2.syncfusion.com/angular/documentation/api/treegrid#databound
We hope this helps. If you have any further questions,
please don't hesitate to ask.
Regards,
Farveen sulthana T
If this post is
helpful, please consider Accepting it as the solution so that other members can
locate it more quickly.