Reputation: 69
I use ag-grid on own aplication. I use option checkboxSelection: true.When i click on checkbox event selectionChanged do not consist form data of row.How to get this data?
code
<ag-grid-common #agGridComponent
[gridName]="gridName"
[rowData]="supersessionParts"
[columnDefinitions]="columnDefs"
[nodeChildDetails]="getNodeChildDetails"
(selectionChanged)="selectionChanged($event)">
</ag-grid-common>
code for set checkbox
{
headerName: 'Cart',
lexid: 4456,
colId: 'selectColumnAdvanced',
field: 'group',
checkboxSelection: true,
suppressResize: true,
suppressMovable: true,
suppressSorting: true,
minWidth: 30,
width: 35,
headerComponentFramework: <{new(): CartHeaderComponent}>CartHeaderComponent
}
Upvotes: 3
Views: 3462
Reputation: 5698
The (selectionChanged)
callback has the parameter of type SelectionChangedEvent
which contains the grid api. From the api, you can get the selected row(s). So your selectionChanged
should look like:
onSelectionChanged(event: SelectionChangedEvent) {
console.log(event.api.getSelectedRows());
}
This is way to go as specified in the ag-grid documentation (see here).
Upvotes: 2