ag-grid-enterprise icon indicating copy to clipboard operation
ag-grid-enterprise copied to clipboard

Suppress onRowClicked when clicking on cell with onCellClicked

Open stefanschmidcyanit opened this issue 4 years ago • 1 comments

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/ceolter/ag-grid-enterprise/blob/master/CONTRIBUTING.md#question

Current behavior

  • Having a onRowClicked event handler in the grid options
  • Having a onCellClicked event handler in a column definition
  • Clicking a cell with a onCellClicked handler fires the onRowClicked event first, then the onCellClicked event

Example:

  • Table shows a list of employees
  • Column "dept. no." has an onCellClicked handler which navigates to the department of that employee
  • onRowClicked event handler navigates to a details view of the employee

Expected behavior

Either

  • Suppress onRowClicked event generally when clicking on a cell with onCellClicked event

or

  • Adding an option to the column definition, e. g. suppressRowClicked: true

or

  • Add a way to check in the onRowClicked event which column has been clicked, to see if there's a cell click handler and prevent the row click event from being executed

Minimal reproduction of the problem with instructions

  • Demo: https://next.plnkr.co/edit/Oyu0KSZ2WoudJQyI?preview
  • Clicking on a cell in the column "Make" will first fire the onRowClicked event, then onCellClicked and currently there's no way to prevent onRowClicked

What is the motivation / use case for changing the behavior?

We had this functionality in our old datatables.net tables (requested by our customer) and we are now migrating that table to ag-grid.

Please tell us about your environment:

  • ag-Grid-Enterprise version: 22.1.1
  • Browser: all
  • Language: all

stefanschmidcyanit avatar Mar 06 '20 10:03 stefanschmidcyanit

Hi, is there any updates on this matter?

DantonGodoy avatar Jul 05 '22 18:07 DantonGodoy