search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

No source variable in ContextMenu when opened programatically with TouchEvent

Asked by Pascal
7 months ago.

Hi

When I try to open the ContextMenu of an event programatically with "contextMenu.show(e);" there will be no source field available in this as described here: https://api.daypilot.org/daypilot-menu-show/

However, I have noticed this only happens if the event that triggers the ContextMenu is a TouchEvent.
If it is fired from MouseEvent the source field will be there.

Is there a solution for my problem? Or is it not implemented the same way for TouchEvents?

Thanks for any help

Comment posted by Dan Letecky [DayPilot]
7 months ago.

Do you mean that the problem only appears when you open the menu item using "tap" gesture instead of mouse click?

Or do you mean that you call contextMenu.show() from a touch event handler?

Comment posted by Pascal
7 months ago.

Yes, I mean the problem only happens if coming from the tap gesture instead of mouse click.

Comment posted by Dan Letecky [DayPilot]
7 months ago.

It looks like I'm not able to reproduce the issue using the latest sandbox build. Please see the following demo:

https://javascript.daypilot.org/sandbox/scheduler/eventmenu.html

There is a link below the Scheduler that opens a context menu manually:

Context menu:
var manualMenu = new DayPilot.Menu({
  items: [
      {text:"Show event ID", onClick: function(args) {alert("ID: " + args.source.id);} },
  ]
});
Link:
<a href='javascript:manualMenu.show({id: "test-id"})'>Manual context menu</a>

Can you please give it a try?

Please note that it uses the new "onClick" event handler (instead of the legacy "onclick") which uses "args" parameter.

Let me know if the problem persists with the latest sandbox build (2018.3.3366).

Answer posted by Pascal
7 months ago.

Hi Dan

Thank you so much for your help.
I upgraded to the latest stable version 2018.3.3353 and now it works without any issue...

PS: I noticed that I can't install the sandbox version as pro version with my key. Is this behaviour desired? I didn't want to downgrade from pro to trial for testing out the sandbox version. Thankfully it works with the latest stable verison.

Cheers

Comment posted by Dan Letecky [DayPilot]
7 months ago.

The sandbox version is only available as a trial version. You'll be able to get the licensed version as soon as the next release is available.

This question is more than 6 months old and has been closed. Please create a new question if you have anything to add.