v7.3.0

EventMenu
Feature

A feature which shows a context menu when right-clicking events in the calendar.

There are three predefined items provided by default:

  • deleteEvent Delete the event clicked upon.
  • editEvent Edit the event clicked upon Only present if the EventEdit feature is present (which it is by default).
  • duplicate Duplicate the event clicked upon with the same time and duration, the same resource(s) assigned and a slightly edited name - "<old name> (copy)".

The items set can be reconfigured by providing an items property to this feature:

const calendar = new Calendar({
    features : {
        eventMenu : {
            items : {
                // Removes the predefined deleteEvent item
                deleteEvent : null,

// Add our own custom item postpone : { text : 'Postpone 1h', weight : 300, icon : 'fa fa-fw fa-arrow-down', onItem({ item, eventRecord }) { eventRecord.shift(1, 'h'); } } } } } });

Items may also be reconfigured dynamically at run time:

const calendar = new Calendar({
    features : {
        eventMenu : {
            // Process items before menu is shown
            processItems({eventRecord, items}) {
                 // Push an extra item for conferences
                 if (eventRecord.type === 'conference') {
                     items.showSessionItem = {
                         text : 'Show sessions',
                         onItem({eventRecord}) {
                             // ...
                         }
                     };
                 }

// Do not show menu for secret events if (eventRecord.type === 'secret') { return false; } } } } });

The processItems implementation may be an async function which awaits a result to mutate the items object.

This feature is enabled by default.

Useful configs

Config Description
items Menu item definitions (add, remove, or customize)
triggerEvent DOM event that opens the menu (contextmenu, click, dblclick)
processItems Dynamically modify items before showing

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class

Properties

Properties are getters/setters or publicly accessible variables on this class
id: eventMenu

Source path

Calendar/feature/EventMenu.js

Demo

examples/custom-menus

Contents