With AG Grid, prevent row click event when cell is clicked?

Charlie picture Charlie · Dec 14, 2017 · Viewed 11.7k times · Source

I'd like to stop event propagation on all cell clicks since I'm using onRowClicked to do some actions. When a user clicks on something inside a cell (like an input field), I don't want the row click to be triggered.

Any thoughts?

I'm using Angular 2/4 for this.

Answer

Farida Anjum picture Farida Anjum · Feb 23, 2018
  <ag-grid-angular style="width: 100%;   height: 168px;" class="ag-theme-fresh" 
    [rowData]="rowData" [columnDefs]="columnDefs"
    [enableFilter]="true" [enableSorting]="true" 
    [getRowNodeId]="getRowNodeId" [rowSelection]="rowSelection" 
    (selectionChanged)="onSelectionChanged($event)"
    (gridReady)="onGridReady($event)" 
    [suppressRowClickSelection]="true"
    (cellClicked)='onCellClicked($event)'>
  </ag-grid-angular>

Use [suppressRowClickSelection]="true" to prevent the row click