AG-GRID : Use of onRowClicked and onRowDoubleClicked at the same time

3.6k Views Asked by At

Can i use onRowClicked and onRowDoubleClicked at the same time in ag-grid, when i use them both, only onRowClicked is executed.

2

There are 2 best solutions below

0
On BEST ANSWER

There is a serious problem with the implementation though...

When you double click, the click event fires first and it tagged as a "click". So your click handler has no way to know that it's just part of a double click which will be handled elsewhere.

Would have been far more useful if the click event was tagged as a double click. As it is, you have to use your own logic to delay handling the click until after you can determine if it's a double click or not.

0
On

I've just checked and there's no problem with having both events handled:

onRowClicked={() => console.log('Row clicked')}
onRowDoubleClicked={() => console.log('Row double clicked')}

As expected, "Row clicked" is logged before "Row double clicked".

I've checked with:

  • "@ag-grid-community/react": "^22.1.2",
  • "@ag-grid-enterprise/all-modules": "^22.1.2"