Expand detail row on selection of row

Angular ej2 grid

Is it possible to expand a grid detail on selection of the row?


Thanks

5 Replies

IR Isuriya Rajan Syncfusion Team February 8, 2018 05:27 AM UTC

Hi Chris, 

Thanks for contacting Syncfusion support, 

We can expand the detail row while selecting the row .Here we have achieve this using the rowSelected event. It will trigger when row got selected. ”expand ” method will expand selected row. 

Refer the below code example 

rowSelect(){ 
       this.grid.detailRowModule.expand(this.grid.getSelectedRowIndexes())//expand method will expand the selected row 
    } 


Please refer the below sample and documentation for your reference 



Regards, 
Isuriya R 



CB Chris Barber February 8, 2018 08:45 AM UTC

This is fantastic! Thanks for your help.

Further to this, is it possible to collapse if the row is already selected?


IR Isuriya Rajan Syncfusion Team February 9, 2018 05:20 AM UTC

Hi Chris,  

We suspect that you need  to collapse the row, while deselecting the already selected row. We can collapse the expanded row using the “collapse” method 

Code example for your reference  

rowDeselect(){  
       this.grid.detailRowModule.collapse(this.grid.getSelectedRowIndexes())//collapse method will collapse expanded row  
    }  


If we misunderstood your query please get back to us with more information.  

Sample for your reference: 


Regards, 
Isuriya R 



CB Chris Barber February 9, 2018 02:19 PM UTC

Awesome! Works perfectly!


IR Isuriya Rajan Syncfusion Team February 12, 2018 05:50 AM UTC

Hi Chris, 

We were happy to hear your problem has been resolved. Thanks for your reply. 

Regards, 
Isuriya R 


Loader.
Up arrow icon