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

What happens on onEventClick

Asked by Keust
1 month ago.

Hi Dan,

I tried to figure out what actually happens on the Event Click. When I use the console.log is see that the following objects are displayed (as in the documentation): args.e, args.div, args.ctrl, args.meta, args.shift etc.

dp.onEventClick = function(args) {
        console.log(args);
}
// Output is args.e, args.div, args.ctrl, args.meta, args.shift etc.
I tried to generate a function in the ContextMenu e.g.:
{text:"Edit Event", onclick: function() { dp.onEventClick(this.source); } }
// Output is Object { calendar: {…}, data: {…}, isEvent: true, … } (part of the args.e)

How can I accomplish the same data set as when I click on the event as on the button in the context menu?

Answer posted by Dan Letecky [DayPilot]
1 month ago.

The args object of onEventClick event handler stores a number of parameters that are read from the click event handler (such as the ctrl/shift key status). Unfortunately, the onClick handler of the context menu item doesn't extract them so you won't be able to pass them to onEventClick.

However, if you only need the source event (DayPilot.Event) object in the onEventClick handler you can call it like this:

{text:"Edit Event", onclick: function() { dp.onEventClick({e: this.source}); } }
New Reply
This reply is
Your name (optional):