Force click on table row when right clicking it

Hello, I have a context menu to move and block rows of a table. I update the selected row using the selected property. The user has to click on the row and then right click and open the context menu for it to work as expected. Is there a way to automatically click when the user right clicks so the desired row is selected?

I tried to get something like this to work on my own project some time ago, and I was not able to get it to function with a right-click.

What I ended up doing was using a Ctrl+Click by setting a KeyEvent listener on the Session Events that sent a message on KeyDown setting a custom property ctrlDown to True and on KeyUp setting it to False. Then in the table's rowOnClick event I checked if this property was true and used that to trigger the alternate action that would have been done via a right-click.

Worked pretty smoothly for me, but I'm not as savvy as some of the folks on here so maybe its not the best solution. :laughing:

1 Like

In order to achieve something similar in the past, I have had each column be a view render and used labels for non visual needs. The row index is then passed into the view automatically as a parameter.
Perspective - Table | Ignition User Manual

See the docs for all available params passed in implicitly.

Then when a right click is made you can fire off a system.perspective.sendMessage and select the row when a messageHandler is invoked on the table side.

This is a bit of a weird work around but, it has done us well.
Something to note, if your table is going to have a ton of records (10K+) view rendering time for the columns can be a bit degraded, so base this on your use case.

1 Like