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

Get selected rows details on a button click

I need to get the selected row details from the treegrid. 
I have button, when clicking on the button I need to capture the row data.


1 Reply

FS Farveen Sulthana Thameeztheen Basha Syncfusion Team November 13, 2019 12:04 PM UTC

Hi Nithin, 

Thanks for contacting Syncfusion Support. 

Query#:- I need to get the selected row details from the treegrid. I have button, when clicking on the button I need to capture the row data. 
 
We have checked your query and if you want to get the selected row details you can use getSelectedRecords method of the TreeGrid pn external button click.  
 
Refer to the code example:- 
 
<button ej-button class='e-flat' (click)='add()'> selectedrecords </button> 
          <ejs-treegrid [dataSource]='sampleData' [treeColumnIndex]='1' childMapping='subtasks' [selectionSettings]='selectionSettings'> 
                       <e-columns > 
                                     <e-column field='taskID' headerText='Task ID' textAlign='Right' width=70> 
                                                          
                                    </e-column> 
                                .     .    . 
                      </e-columns> 
                       </ejs-treegrid> 
add(): void { 
       var tree = document.getElementsByClassName('e-treegrid')[0].ej2_instances[0]; 
        var records = tree.getSelectedRecords(); 
        alert(records) 
         
    } 
 
 
 
Please get back to us if you need any further assistance. 
 
Regards, 
Farveen sulthana T 


Loader.
Live Chat Icon For mobile
Up arrow icon