Hi Juan,
Greetings from Syncfusion Support.
Query: With a button or something, expands only item 1 but item 2 keeps collapsed.
We have achieved your requirement by using the expandRow method of Tree Grid. Please refer to the sample code below,
onClick() {
if (this.treegrid) {
this.treegrid.expandRow(this.treegrid.getRowByIndex(0)) // get the desire row by passing the desire index
}
}
render() {
this.onClick = this.onClick.bind(this);
return (
…………..
<ButtonComponent id='expand' onClick={this.onClick}>Expand Row</ButtonComponent>
<TreeGridComponent .. ref={g => this.treegrid = g} ………. >
<ColumnsDirective>
………………
</ColumnsDirective>
</TreeGridComponent>
</div>
</div>);
}
}
|
In the example above, click on the external button we expand the specific one by passing the desired row and using the getRowByIndex method, we can get the desired row by passing the index value.
Also, refer to the link below for the API documentation.
Please get back to us if you need any assistance. We will be glad to support you.
Regards,
Manivannan Padmanaban