How to retrieve the selected records in the Grid in Angular Grid

Hi, I am following this example - https://ej2.syncfusion.com/angular/demos/?_ga=2.133986510.1538252749.1576809616-867896921.1564449587#/material/grid/checkbox-selection

When a user checks a few records, how can I add the selected record attributes such as "orderId" to a list?

1 Reply

SS Seeni Sakthi Kumar Seeni Raj Syncfusion Team December 30, 2019 09:12 AM UTC

Hi Jose,  
 
Greetings from Syncfusion.  
 
Using the getSelectedRecords method, you can retrieve the selected records and therefore, OrderID values will be retrieved. Refer to the following code example.  
 
    @ViewChild('grid', {static: true}) 
    public grid: GridComponent; 
 
    public onClick(): void { 
      console.log(this.grid.getSelectedRecords().map((e)=>e['OrderID'])); 
    } 
 
 
 
Regards,  
Seeni Sakthi Kumar S 


Loader.
Up arrow icon