jQuery-contextMenu icon indicating copy to clipboard operation
jQuery-contextMenu copied to clipboard

Trigger Menu Open

Open aliaezat opened this issue 7 years ago • 3 comments

Hi there,

I am trying to create jQuery-contextMenu on daypilot scheduler event (DayPilot.org) but the scheduler context menu is conflicting with it. Basically, daypilot is preventing the contextmenu event propagation. So, my question is, Is there a way I can get jQuery-contextMenu manually without explicitly triggering 'contextmenu' event like in using:

$(".some-selector").contextMenu(); $(".some-selector").contextMenu({x: 123, y: 123});

aliaezat avatar Jul 25 '18 20:07 aliaezat

Doesn't the code you provided work? That should open the contextmenu manually as mentioned in docs

bbrala avatar Aug 08 '18 10:08 bbrala

It doesn't work because I have to call it from within a contextmenu event handler which causes an infinit recursion. I need away to open the context menu directly without triggering the 'contextmenu' event.

aliaezat avatar Aug 08 '18 11:08 aliaezat

Agreed, having the same issue here. Ends up with an infinite loop. In my case, setting a listener on contextmenu, and then conditionally deciding whether to open the menu or not (or default browser one instead), and if yes, the only way to trigger the menu is using contextmenu, which calls itself.

So ideally, we should have a function like $contextMenu.show() which is triggered by the contextmenu event, which would allow a developer to trigger it from other places, or handle the contextmenu event themselves.

russelltrafford avatar Oct 19 '18 22:10 russelltrafford