We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

treeColumnIndex not consider the front column that visible is false?


If the tree grid first colunmn' visible is false,  treeColumnIndex is set to 1, the expander button is not  at the second column,

is this problem a bug? will you change the logic in the future?

1 Reply

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team May 1, 2023 07:56 AM UTC

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:-



<ejs-treegrid #treegrid









        <e-column field="duration"













        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




     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.


Farveen sulthana T

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Live Chat Icon For mobile
Up arrow icon