Di_
Di_

Reputation: 101

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

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

Upvotes: 1

Views: 4701

Answers (2)

Ian Bale
Ian Bale

Reputation: 201

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.

Upvotes: 2

user1068352
user1068352

Reputation: 632

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"

Upvotes: 3

Related Questions