Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select rows on right click in Ag-grid

This might be a rather simple question to answer.

I'm using Ag-Grid with React (ag-grid community + enterprise)

I noticed that if I right click on a row and I select an action on the context menu that appears, it will apply the action to the row that was actually selected and not the one I right-clicked on. How can I select a row with a right-click?

I will add details of my code on demand if needed. Thanks in advance.

like image 486
Manzana Avatar asked Jan 27 '26 10:01

Manzana


1 Answers

You can hook in cellContextMenu grid event and select the corresponding row as the first thing before proceeding to the rest of the logic. Something like this:

<AgGridReact onCellContextMenu={event => event.node.setSelected()}>
like image 91
Shankul Avatar answered Jan 30 '26 23:01

Shankul



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!