Manually expanding nodes.

Hello

Is there a property or function that allow to expand nodes manually?, there is an ExpandAll, but i need a more selective one.

Example:

     Grid.
          Item 1
               SubItem 1-1
          Item 2
               SubItem 2-1

With a button or something, expands only item 1 but item 2 keeps collapsed.

Regards

1 Reply 1 reply marked as answer

MP Manivannan Padmanaban Syncfusion Team September 17, 2020 05:18 AM UTC

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={=> 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 


Marked as answer
Loader.
Up arrow icon