Hi Julien,
To achieve your requirement, we have get the row index value for a particular record
in a TreeGrid and select it with the help of its primary key value.
This can be achieved by passing the required primary key value to the getRowIndexByPrimaryKey method from Grid instance which
that returns the index value of the row. With the help of this row index value
the particular record can be selected by using the selectRow method.
Refer to the code below:-
|
App.Component.html:-
<button ej-button (click)="selectRow()">selectRow</button>
<ejs-treegrid
#treegrid
[dataSource]="data"
childMapping="subtasks"
height="550"
[treeColumnIndex]="1"
>
.
. .
</e-columns>
</ejs-treegrid>
App.Component.ts:-
selectRow()
{
var index = this.treegrid.grid.getRowIndexByPrimaryKey(9);
// Select the row using the index value
this.treegrid.selectRow(index);
}
|
Sample link:- https://stackblitz.com/edit/angular-nykyyt-emqozv?file=app.component.html,app.component.ts
API link:- https://ej2.syncfusion.com/angular/documentation/api/grid#getrowindexbyprimarykey
Please get back to us if you need any further assistance.
Regards,
Farveen sulthana T