Home > Enterprise >  Ag-Grid : How to get the value of the cell on clicking the cell
Ag-Grid : How to get the value of the cell on clicking the cell

Time:12-03

how can I get the value of the cell when the cell is clicked clicked in Angular?

this is my HTML :

    <ag-grid-angular  
    style="width: 100%; height: 300px;" 
    
    [rowData]="list" 
    [columnDefs]="columnDefs"
    [defaultColDef]="defaultColDef"
    [pagination]="true"
    [modules]="modules"
    >
    </ag-grid-angular>

CodePudding user response:

Listen to cellClicked event https://www.ag-grid.com/angular-data-grid/grid-events/

<ag-grid-angular  
style="width: 100%; height: 300px;" 

[rowData]="list" 
[columnDefs]="columnDefs"
[defaultColDef]="defaultColDef"
[pagination]="true"
[modules]="modules"
(cellClicked)="onCellClicked($event)"
>
</ag-grid-angular>
onCellClicked(cellData){
  console.log(cellData.value)
}
  • Related