Perspective Table How to Handle Right Click Copy Event

When you right click a table it brings up a context menu with the option to copy on it. How can I handle this event? I don’t see any information on the table documentation page. Or if you can’t, how can I disable this menu?

1 Like

Hi @nick.christensen1, there is the ‘Prevent Default’ option for component events. Not sure if this will apply though :thinking:

https://docs.inductiveautomation.com/display/DOC81/Component+Events+and+Actions

It sounds like that would be the solution, but I tried applying a script to the onContextMenu event with “Prevent Default” checked and it did not stop the context menu from appearing.

Yes I was worried that might be the outcome. Unfortunately, I have nothing further to add :disappointed: sorry.

i might have a hacky solution to make it invisible...

if you create a style class and paste this

}.contextMenuCommon.ia_contextMenu{display:none;}{

into for example the background image.

The copy popup will no longer be visible and clickable. It still triggers the event tho.

Also this will now work on all tables you have in the project, so if do want it somewhere else you will have to change it a bit to be more specific.

You can "inject" css in the styles. You can probably also change the styles somewhere else in the base files but this is easier for a quick fix.

There probably is a better way but idk it

10 Likes

That's so sneaky. I love it.

3 Likes

That did it. Like you said, certainly not the way I’d like to do it but it’s better than nothing.

1 Like

Ingenius! :grinning_face_with_smiling_eyes:

2 Likes

image

just like this simple and work

A lot of functionality has been added to Perspective in the two years since the hacky workaround above was developed. (Check dates on your topics when posting.)