CalendarMixin
Mixin
Mixin that provides the core shared functionality for all Calendar view widgets, including event rendering, store management, feature support, keyboard navigation, and date-based scrolling. Any widget that participates as a Calendar mode (such as DayView, WeekView, MonthView, YearView, AgendaView, and EventList) mixes in this class to gain a consistent API for event display, hit-testing, resource avatar rendering, and interaction with the parent Calendar.
This mixin also brings in the Featureable mixin.
All Calendar views share these common APIs from this mixin. For example:
const calendar = new Calendar({
modes : {
week : {
// Configs from CalendarMixin available on all view types
eventHeight : 22,
autoCreate : {
duration : '1 hour',
startHour : 9
},
eventRenderer({ eventRecord, renderData }) {
// Custom event rendering logic
renderData.cls['high-priority'] = eventRecord.priority === 1;
return eventRecord.name;
}
}
}
});
// Navigate the active view
calendar.activeView.next();
calendar.activeView.previous();
// Scroll to a specific date
calendar.activeView.scrollTo(new Date(2024, 0, 15));
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Configure this as
falseto disable drag-creating events in this view.Has a corresponding runtime allowDragCreate property.
-
Configure this as
falseto disable drag-moving events in this view.Has a corresponding runtime allowDragMove property.
-
Configure this as
falseto disable drag-resizing events in this view.Has a corresponding runtime allowDragResize property.
-
Set to
falseif you don't want to allow events overlapping times for any one resource (defaults to true). -
The class name to add to calendar cells.
Has a corresponding runtime dayCellCls property.
-
Configure as
trueto hide nonWorkingDaysHas a corresponding runtime hideNonWorkingDays property.
-
The maximum date to which the
endDateof this view may be navigated.Has a corresponding runtime maxDate property.
-
The minimum date to which the
startDateof this view may be navigated.Has a corresponding runtime minDate property.
-
The class name to add to calendar cells which are non working days.
-
nonWorkingDays : Object<Number, Boolean>
Non-working days as an object where keys are day indices, 0-6 (Sunday-Saturday), and the value is
true. Defaults to nonWorkingDays.Has a corresponding runtime nonWorkingDays property.
-
A button configuration object to use for the automatically created mode selector button for this mode.
-
A menu item configuration object to use for the automatically created mode selector menu item for this mode.
-
The class name to add to events which have duration less than or equal to shortEventDuration.
-
A title text used by the Calendar's mode selector button. If not specified, the mode name is used.
-
The week start day, 0 meaning Sunday, 6 meaning Saturday. Defaults to weekStartDay.
-
The class name to add to calendar cells which are weekend days.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of CalendarMixin class, or subclass thereof.
-
This property yields this widget. This is to enable Calendar Features to be able to attach to standalone Calendar widgets as their owning client, and to access a currently active view in a standard way.
-
This property yields this widget. This is to enable Calendar Features to be able to attach to standalone Calendar widgets as their owning client, and to access a currently active view in a standard way.
-
Configure this as
falseto disable drag-creating events in this view.Has a corresponding allowDragCreate config.
-
Configure this as
falseto disable drag-moving events in this view.Has a corresponding allowDragMove config.
-
Configure this as
falseto disable drag-resizing events in this view.Has a corresponding allowDragResize config.
-
The class name to add to calendar cells.
Has a corresponding dayCellCls config.
-
The duration in total days that this view covers.
-
Returns the pixel value of the eventHeight in case it was configured as a CSS measurement in other units.
-
The first visible event-bearing element in this view. So if the first day defined in the range is a Sunday, and hideNonWorkingDays is set, then the first visible cell will be for the Monday.
-
The date of the first visible event-bearing element in this view. So if the first day defined in the range is a Sunday, and hideNonWorkingDays is set, then the first visible date will be the date of the Monday.
-
Configure as
trueto hide nonWorkingDaysHas a corresponding hideNonWorkingDays config.
-
The last visible event-bearing element in this view. So if the last day defined in the range is a Sunday, and hideNonWorkingDays is set, then the last visible cell will be for the Friday.
-
The date of the last visible event-bearing element in this view. So if the last day defined in the range is a Sunday, and hideNonWorkingDays is set, then the last visible date will be the date of the Friday.
-
The maximum date to which the
endDateof this view may be navigated.Has a corresponding maxDate config.
-
The minimum date to which the
startDateof this view may be navigated.Has a corresponding minDate config.
-
Calendar mode that this view represents (eg. "day", "month" etc). Only accessible when used within a Calendar.
-
nonWorkingDays : Object<Number, Boolean>
Non-working days as an object where keys are day indices, 0-6 (Sunday-Saturday), and the value is
true. Defaults to nonWorkingDays.Has a corresponding nonWorkingDays config.
-
A DateHelper format string/function to use to create date output for abbreviated view descriptions.
Has a corresponding shortDateFormat config.
-
A DateHelper format string/function to use to create date and time output for abbreviated view descriptions.
Has a corresponding shortDateTimeFormat config.
-
Identifies an object as an instance of CalendarMixin class, or subclass thereof.
Functions
Functions are methods available for calling on the class-
next( )
-
previous( )
-
undoRedoDataChange( )internal
The key handler for CTRL+Z undo key combination. If enableUndoRedoKeys is enabled, the last data change will be undone.