EventBuffer
Feature
Feature that allows showing additional time before & after an event, to visualize things like travel time - or the time you need to prepare a room for a meeting + clean it up after. You can configure whether the buffer time intervals should be considered busy time or available time using bufferIsUnavailableTime.
The feature relies on two model fields: preamble and postamble which are used to calculate overall start and end dates used to position the event. Buffer time overlaps the same way events overlap (as you can see in the inline demo below). It should also be noted that buffer time is ignored for milestones.
targetElement.innerHTML = '<p>Open editor to change setup / cleanup:</p>'; const schedulerPro = new SchedulerPro({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2022, 4, 6, 9), endDate : new Date(2022, 4, 6, 17), viewPreset : 'hourAndDay', barMargin : 12, columns : [ { type : 'resourceInfo', field : 'name', text : 'Meeting Rooms', showEventCount : false, showMeta : record => `Car: ${record.car}`, width : 150 } ], features : { eventBuffer : { renderer({ eventRecord, preambleConfig, postambleConfig }) { if (eventRecord.preamble) { preambleConfig.icon = 'fa fa-car'; preambleConfig.cls = 'travel-before'; preambleConfig.text = eventRecord.preamble.toString(true); } if (eventRecord.postamble) { postambleConfig.icon = 'fa fa-car'; postambleConfig.cls = 'travel-after'; postambleConfig.text = eventRecord.postamble.toString(true); } } } }, project : { resources : [ { id : 1, name : 'John', car : 'Tesla', image : false, iconCls : 'fa fa-user' }, { id : 2, name : 'Eva', car : 'Honda', image : false, iconCls : 'fa fa-user' }, { id : 3, name : 'Dan', car : 'Buick', image : false, iconCls : 'fa fa-user' } ], events : [ { id : 1, resourceId : 1, name : 'UN Meeting', startDate : '2022-05-06T10:00:00', duration : 3, durationUnit : 'h', preamble : '1 hour', postamble : '30 minute' }, { id : 2, resourceId : 2, name : 'Board meeting', startDate : '2022-05-06T11:00:00', duration : 2, durationUnit : 'h', preamble : '20 minute', postamble : '25 minute', resizable : false, eventColor : 'red' }, { id : 3, resourceId : 3, name : 'Starbucks meeting', startDate : '2022-05-06T13:00:00', duration : 3, durationUnit : 'h', preamble : '25 minute', postamble : '15 minute', resizable : false, eventColor : 'red' } ], calendars : [ { id : 'general', name : 'General', intervals : [ { recurrentStartDate : 'on Sat', recurrentEndDate : 'on Mon', isWorking : false } ] } ], calendar : 'general' } }); This feature is disabled by default
Useful configs
| Config | Description |
|---|---|
| showDuration | Show buffer duration labels |
| bufferIsUnavailableTime | Treat buffer time as unavailable |
| renderer | Customize preamble/postamble rendering |
| tooltipTemplate | Custom tooltip for buffer elements |
See also
- preamble — Model field defining buffer time before an event
- postamble — Model field defining buffer time after an event
- SchedulerPro — The Scheduler Pro view this feature plugs into
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
Show buffer duration labels
Has a corresponding runtime showDuration property.
-
Internal listeners, that cannot be removed by the user.
-
The widget which this plugin is to attach to.
Has a corresponding runtime client property.
-
Set to
falseto disable localization of this object.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of EventBuffer class, or subclass thereof.
-
Identifies an object as an instance of Events class, or subclass thereof.
-
Identifies an object as an instance of Localizable class, or subclass thereof.
-
A class property getter for the default values of internal properties for this class.
-
Show buffer duration labels
Has a corresponding showDuration config.
-
A function that receives data about the buffer time and returns a HTML string to show in a tooltip when hovering a buffer time element
Has a corresponding tooltipTemplate config.
-
An empty array that can be used as a default value.
-
An empty object that can be used as a default value.
-
Identifies an object as an instance of EventBuffer class, or subclass thereof.
-
Identifies an object as an instance of InstancePlugin class, or subclass thereof.
-
Returns a copy of the full configuration which was used to configure this object.
-
This property is set to
truebefore theconstructorreturns. -
This property is set to
trueon entry to the destroy method. It remains on the objects after returning fromdestroy(). If isDestroyed istrue, this property will also betrue, so there is no need to test for both (for example,comp.isDestroying || comp.isDestroyed). -
The Widget which was passed into the constructor, which is the Widget we are providing extra services for.
Has a corresponding client config.
-
Get the global LocaleHelper
-
Get the global LocaleManager
Functions
Functions are methods available for calling on the class-
This optional class method is called when a class is mixed in using the mixin() method.
-
Registers this class type with its Factory
-
Internal function used to hook destroy() calls when using thisObj
-
Internal function used restore hooked destroy() calls when using thisObj
-
Auto detaches listeners registered from start, if set as detachable
-
Internal function used to run a callback function after an event is triggered
-
Removes all listeners registered to this object by the application.
-
This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.
Events
Events are triggered for certain actions in this class and can be listened for to react to those actions in your codeEvent handlers
Event handlers are callbacks called as a result of certain actions in this classCSS variables
CSS variables that can be set to adjust appearance| Name | Description |
|---|---|
| --b-event-buffer-color | Event buffer line color |
| --b-event-buffer-label-color | Event buffer label color |