EventMenu
Feature
A feature which shows a context menu when right-clicking events in the calendar.
There are three predefined items provided by default:
deleteEventDelete the event clicked upon.editEventEdit the event clicked upon Only present if the EventEdit feature is present (which it is by default).duplicateDuplicate 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
- ScheduleMenu — Context menu for empty calendar areas
- EventEdit — Feature for editing events from the menu
- EventCopyPaste — Adds copy/cut/paste items to this menu
No results
Configs
Configs are options you supply in a configuration object when creating an instance of this classProperties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of EventMenu class, or subclass thereof.
-
Identifies an object as an instance of EventMenu class, or subclass thereof.