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.
There is no option in the library to make a single row disabled(both visually and keyboard event based), the only way we could make a single row disabled is by using a customCellRenderer for both header and subsequent cell checkboxes, this allows full control over the checkbox.
If you want the grid to stop editing when focus leaves the cell or the grid, set the grid property stopEditingWhenCellsLoseFocus = true .
Select a row by clicking on it. Selecting a row will remove any previous selection unless you hold down Ctrl while clicking. Selecting a row and holding down Shift while clicking a second row will select the range.
gridOptions. suppressCellSelection = true; but this just hides the checkbox whereas i need to show the checkbox in disable mode. Thanks. never used this lib, but it looks like that you have to add some property to each row you want to disable, instead of looking for a grid-wide solution.
None of the past suggestions worked for me. AG Grid may have changed the API behavior. Even event.stopPropagation()
on onCellClicked
would not stop onRowClicked
from firing.
What I ultimately did was to remove onRowClicked
altogether and handle everything in onCellClicked
. onRowClicked
does not have an attribute on which column the click event generated from, onCellClicked
does!
function cellClickedHandler(e) {
if (e.column.colId === 'col1') {
// Handle specific cell
} else {
// Handle all other cells, similar to rowClicked
}
}
<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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With