Eventcalendar API
Here is a comprehensive list of all the options, events and method the Eventcalendar has.
Options
Explore the following API options that help you easily configure the Eventcalendar.
actionableEvents
boolean
Specifies if the events on the agenda and inside the calendar popover are actionable or not.
If actionable, the event items will have hover and active states, and pointer cursor.
Set to false when custom event rendering is used and the event list items contain other actionable elements, e.g. buttons.
Default value: true
clickToCreate
boolean | "double" | "single"
Enable new event creation on click. If true or 'double', a new event will be created only with a double click
and with the 'single' value the event will be created instantly with a single click.
This option will only work on desktop environment where mouse events are fired. It will also allow deleting of the focused events using the Delete or Backspace key.
In touch environment a long tap should be used to create a new event and it is controlled by the dragToCreate option.
Using the extendDefaultEvent option extra properties can be set for the created event.
The event deletion functionality can be overwritten using the eventDelete option.
Default value: undefined
colors
Array<MbscCalendarColor>
Specifies the color for certain dates or date ranges on the calendar.
The MbscCalendarColor type has the following properties:
allDay: boolean - Specifies whether the date you want to color is all day or not.background: string - Background color of the cell. It can be any valid CSS color ('red','#ff0000','rgb(255, 0, 0)', etc.).cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.cssClass: string - Specifies a custom CSS class for the color. Useful when customization is needed for the background of cells and time ranges. Only applicable for the timeline and scheduler views.date: string | object | Date - Specifies a single date for the colorend: string | object | Date - Specifies the end date/time of a date/time range for the colorhighlight: string - Highlight color of the day, can be any valid CSS color ('red','#ff0000','rgb(255, 0, 0)', etc.).recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring days.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resource: string | number | Array<string | number> - In case of the timeline and scheduler view of the Eventcalendar, specifies the resource ids for the color. The color will be displayed only on the specified resource. If there is no resource defined, it will be applied to every resource.slot: string | number - In case of the timeline view of the Eventcalendar, specifies the slot id for the color. The color will be displayed only on the specified slot. If there is no slot defined, it will be applied to every slot.start: string | object | Date - Specifies the start date/time of a date/time range for the colortextColor: string - A color applied on the text.title: string - A title that will be displayed on the item.
The colored range will be considered all-day if:
- the
allDayproperty is explicitly set. - the
start/endproperties are not specified, only thedate.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
[
{ date: new Date(2020, 2, 23), background: 'pink' },
{ date: new Date(2020, 2, 24), background: 'green' },
{ background: '#ff0000', recurring: { repeat: 'weekly', weekDays: 'SU' } },
{ background: 'yellow', recurring: { repeat: 'weekly', weekDays: 'SA' } }
]
Default value: undefined
connections
Array<MbscEventConnection>
Specifies connections between events. On the UI events will be linked with lines and additionally arrows can be displayed to illustrate the direction of the connection. Events can have multiple connections simultaneously.
An array of connection objects can be passed.
The MbscEventConnection type has the following properties:
arrow: boolean | "from" | "to" | "bidirectional" - Specifies where to display arrows Iftrue, the arrow will display only at the end side of the connection.color: string - Specifies the color of the connection.cssClass: string - Custom CSS class for the connection line for further customization.from: string | number - The id of the event where the connection will beginto: string | number - The id of the event where the connection will end.type: "fs" | "sf" | "ss" | "ff" - The type of the connection. Possible values:'fs'- finish-to-start,'sf'- start-to-finish,'ss'- start-to-start,'ff'- finish-to-finish.
Default value: undefined
context
string | HTMLElement
The DOM element in which the popups (event popover, year and month picker) are rendered. Can be a selector string or a DOM element.
Default value: 'body'
cssClass
string
Specifies a custom CSS class for the component.
Default value: undefined
data
Array<MbscCalendarEvent>
The events for the Eventcalendar.
The MbscCalendarEvent type has the following properties:
allDay: boolean - Specifies if the event is all day or not.bufferAfter: number - Defines a buffer time in minutes that will be displayed after the end of the event.bufferBefore: number - Defines a buffer time in minutes that will be displayed before the start of the event.cellCssClass: string - CSS class for the day cell. Only applicable for the calendar view.color: string - Background color of the eventcssClass: string - Specifies a custom CSS class that is applied to the event. Useful when customization is needed on the event level. For example: setting the width for specific events.date: string | object | Date - Specifies a single date for the eventdragBetweenResources: boolean - Specifies whether the event is movable across resources.dragBetweenSlots: boolean - Specifies whether the event is movable across across slots.dragInTime: boolean - Specifies whether the event is movable in time.editable: boolean - Specifies if an event is editable or not. If false, drag & drop and resize is not allowed.end: string | object | Date - Specifies the end date/time of a date/time range for the eventid: string | number - A unique id for the event. If not specified, the event will get a generated id.order: number - Specifies the order of the event in the array. Has precedence over the default ordering rules.overlap: boolean - Specifies whether the event can be overlapped. Has precedence over theeventOverlapproperty of the resource and the eventOverlap option.recurring: string | MbscRecurrenceRule - Specifies a recurrence rule for handling recurring events.recurringException: string | object | Date | Array<string | object | Date> - Exception dates of the recurring rule. Useful when specific dates need to be skipped from the rule.recurringExceptionRule: string | MbscRecurrenceRule - Exception rule of the recurring rule. Useful when recurring dates need to be skipped from the rule.resize: boolean - Specifies whether the event is resizable. Has precedence over theeventResizeproperty of the resource and the dragToResize option.resource: string | number | Array<string | number> - In case of the timeline and scheduler view of the Eventcalendar, specifies the resource ids for the event. The event will be displayed only on the specified resource. If there is no resource defined, it will be displayed on every resource.slot: string | number - In case of the timeline view of the Eventcalendar, specifies the slot id for the event. The event will be displayed only on the specified slot. If there is no slot defined, it will be displayed on every slot.start: string | object | Date - Specifies the start date/time of a date/time range for the eventtextColor: string - A color applied on the text.timezone: string - Timezone of the eventtitle: string - The title of the event.tooltip: string - The tooltip text of the event.
The dates can be specified as JavaScript Date objects, ISO 8601 strings, or moment objects.
For Javascript Date objects the month numbers are zero based. Like: 0 - January, 1 - February ... 11 - December.
The event objects may have additional custom properties as well. The custom properties are not used by the event calendar, but they are kept and will be available anywhere the event objects are used. E.g. the onEventClick event will receive the event object as argument, containing the custom properties as well.
Use the getEvents method to get the events between two dates.
data: [
{
start: new Date(2021, 5, 23),
end: new Date(2021, 5, 30),
title: 'Conference',
allDay: true,
color: 'red'
},
{
title: 'Work project',
recurring: {
repeat: 'daily',
until: '2021-04-01'
},
recurringException: ['2021-03-15', '2021-03-25'],
recurringExceptionRule: {
repeat: 'weekly',
weekDays: 'SA,SU'
}
}
]
Default value: undefined
dataTimezone
string
The timezone in which the data is interpreted. If the data contains timezone information
(when the ISO string has a timezone offset, e.g. "2021-03-28T01:00:00Z" or "2021-03-28T03:00:00+03:00")
then the data's timezone is used instead.
When using timezones, the exclusiveEndDates option is also turned on by default.
When using anything other than the default ('local'), a timezone plugin
must be also passed to the component.
Possible values:
'local'- The system's local timezone.'utc'- UTC (Universal Coordinated Time) timezone.- Timezone name - The timezone name from the
IANA time zone database, e.g.
"America/New_York".
If not specified, it defaults to the displayTimezone.
Default value: undefined
defaultSelectedDate
Specifies the initial selected date on the calendar.
For views, where time is also displayed, the view will be scrolled to the specified time. If the time part is not explicitly specified, it defaults to the start of the day.
Default value: undefined
displayTimezone
string
The timezone in which the data is displayed.
When using timezones, the exclusiveEndDates option is also turned on by default.
When using anything other than the default ('local'), a timezone plugin
must be also passed to the component.
Possible values:
'local'- The system's local timezone.'utc'- UTC (Universal Coordinated Time) timezone.- Timezone name - The timezone name from the
IANA time zone database, e.g.
"America/New_York".
Default value: 'local'
dragBetweenResources
boolean
If false, the events will not be moveable across resources, only in time.
To control movement in time, use the dragInTime option.
Consider that dragToMove has to be enabled.
Default value: true
dragBetweenSlots
boolean
If false, the events will not be moveable across slots, only in time and resource.
To control movement in time, use the dragInTime option.
Consider that dragToMove has to be enabled.
Default value: true
dragInTime
boolean
If false, the events will not be moveable in time.
In case of the scheduler and timeline views events events can still be moved between resources.
To control movement between resources, use the dragBetweenResources option.
Consider that dragToMove has to be enabled.
Default value: true
dragTimeStep
number
Specifies the steps in minutes for the scheduler and timeline events during drag.
Default value: 15
dragTimeStepBase
"viewStart" | "dayStart"
Specifies the base of the dragTimeStep calculation.
If set to 'viewStart' it takes the startTime property of the view option as reference.
Default value: 'dayStart'