Hi there:

I’m wondering if there is a way to detect which row of the table the user RIGHT-click on. I want to be able to show different context menu depending on which row the user RIGHT-clicks. Note that the row does NOT need to be selected, so the selection change event does not apply here.

Is there a way to accomplish this?

3 answers

Hi Justin, it is possible to achieve this by calculating the cursor position.

Below is an example:


Thanks Vivi. That will do for now, but it’s labor intensive: If I have many rows, and each row has different height, I would potentially need to do a lot of manual calculations to find out the corresponding y coordinate of the, say, 25th row. Also, if later on, for some reason, I insert a couple of extra rows or delete a couple of rows or change the height of several rows, then ALL my calculations would be off and I’d have to start all over again.

For future enhancement, I would really like to see a way where the table row and column can be directly referenced.



There is another work around: make your table cell content outside and then embed it into table. Then you can define the “Element Right Click” event handler for the table cell content.


This question is now closed