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

how to show contextMenu when right-click on timeRange

Asked by RajeshBoora
9 years ago.

Hi,
I'm working with the Day pilot Pro JavaScript - Event calendar - v1531.

I'm trying to display a contextMenu when user right-clicked on the empty cell (time range). I have gone through the below documentation links but it doesn't explain how to achieve this in event calendar control.
http://doc.daypilot.org/calendar/context-menu/
http://doc.daypilot.org/calendar/time-range-context-menu/

I have tried something with the timeRangeSelectedHandling: "Hold"/"JavaScript". I'm bit struck with how to create/attach the context menu to timeRangeRightClick.
Please find the fiddle here:
http://jsfiddle.net/RajeshBoora/p4qemLqr/

Please help me to resolve this.

Answer posted by Dan Letecky [DayPilot]
9 years ago.

You need to specify the context menu using .contextMenuSelection:

    dpc.contextMenuSelection = new DayPilot.Menu([
        {text: "New appointment", onclick: function (args) { 
            var start = this.source.start;
            var end = this.source.end;
            var resource = this.source.resource;
            var e = new DayPilot.Event({start: start, end: end, resource: resource, id: DayPilot.guid(), text: "New event"});
            dpc.events.add(e);
            dpc.clearSelection();
         } 
    }]);

See also the updated jsfiddle:

http://jsfiddle.net/p4qemLqr/2/

Comment posted by RajeshBoora
9 years ago.

Thanks...Dan

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