GetEventsMixin
Properties
2
Properties
2Functions
3
Functions
3Events
Returns an array of events for the date range specified by the startDate and endDate options.
By default, for any date, this includes any event which intersects that date.
To only include events that are fully contained within the date range, pass the allowPartial
option as false.
By default, any occurrences of recurring events are included in the resulting array (not applicable in Gantt). If
that is not required, pass the includeOccurrences option as false.
includeOccurrences is true, the start date and end date options are mandatory.
The method must know what range of occurrences needs to be generated and returned.Example:
visibleEvents = eventStore.getEvents({
resourceRecord : myResource,
startDate : scheduler.timeAxis.startDate,
endDate : scheduler.timeAxis.endDate
});
| Parameter | Type | Description |
|---|---|---|
options | Object | An options object determining which events to return |
options.date | Date | If only one date is required, pass this option instead of the
|
options.startDate | Date | The start date for the range of events to include. |
options.endDate | Date | The end date for the range of events to include. Defaults to a startDate + one day range if only startDate passed |
options.resourceRecord | ResourceModel | Pass a resource to only return events assigned to
this resource. Not supported when using the |
options.filter | function | A function to filter out events which are not required. |
options.ignoreFilters | Boolean | By default, store filters are honoured. Pass this
as |
options.includeOccurrences | Boolean | Occurrences of recurring events are included by default. |
options.allowPartial | Boolean | Events which start before or after the range, but intersect the range are included by default. |
options.startOnly | Boolean | Pass |
options.silent | Boolean | Pass |
options.onlyAssigned | Boolean | Pass |
options.dateMap | Boolean | Map | Populates the passed |
Events which match the passed configuration.
Other
This function will find the next available start date where the provided duration fits without causing any
conflicts. It begins by checking the provided resources on the provided startDate. And if any conflicting
events is found, it restarts searching from the last of the conflicting events and continues like this until a
matching time slot is found.
| Parameter | Type | Description |
|---|---|---|
options | Object | |
options.startDate | Date | The date from which to start looking for available date range |
options.duration | DurationConfig | string | The duration of the slot to look for |
options.resources | ResourceModel[] | The resources to include in the search |
options.matchAllResources | Boolean | Set to |
options.stopDate | Date | The date to stop looking for available date ranges. Defaults to 10 years from
|
options.isConflict | function | An optional function which will be called for each conflicting event, making
it possible to return |
options.getValidDate | function | An optional function which will be called for each date ranged that will
be searched for availability. Useful for not allowing certain time slots to be included, like nighttime or
lunch-breaks. Return the new |
{ startDate, resource } - If an available
date range is found, an object will be return containing a matching resource (only if matchAllResources =
false) and the startDate of the date range.
Resource
Checks if a date range is available for a given resource.
Note that when asked to check a 0 duration range, any 0 duration events at the same point in time will be considered overlapping.
| Parameter | Type | Description |
|---|---|---|
startDate | Date | The start date |
endDate | Date | The end date |
excludeEvent | EventModel | EventModel[] | null | An event to exclude from the check (or null) |
resourceRecord | ResourceModel | ResourceModel[] | The resource |
True if the timespan is available for the resource
Events
1
Events
1Fired when a range of events is requested from the getEvents method.
An application may have one of two levels of interest in events being read from a store.
- To be notified when any event block is requested regardless of what the date range is.
- To be notified when a new date range is requested.
This event allows both types of application to be written. The changed property is set if a different date
range is requested.
new Scheduler({
eventStore : {
listeners : {
loadDateRange({ new : { startDate, endDate }, changed }) {
// Load new data if user is requesting a different time window.
if (changed) {
fetch(...);
}
}
}
},
...
});
// Adding a listener using the "on" method
getEventsMixin.on('loadDateRange', ({ source, old, old.startDate, old.endDate, new, new.startDate, new.endDate, changed }) => {
});| Parameter | Type | Description |
|---|---|---|
source | EventStore | This EventStore |
old | Object | The old date range |
old.startDate | Date | the old start date |
old.endDate | Date | the old end date |
new | Object | The new date range |
new.startDate | Date | the new start date |
new.endDate | Date | the new end date |
changed | Boolean |
|
Event handlers
1
Event handlers
1Called when a range of events is requested from the getEvents method.
An application may have one of two levels of interest in events being read from a store.
- To be notified when any event block is requested regardless of what the date range is.
- To be notified when a new date range is requested.
This event allows both types of application to be written. The changed property is set if a different date
range is requested.
new Scheduler({
eventStore : {
listeners : {
loadDateRange({ new : { startDate, endDate }, changed }) {
// Load new data if user is requesting a different time window.
if (changed) {
fetch(...);
}
}
}
},
...
});
new GetEventsMixin({
onLoadDateRange({ source, old, new, changed }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | EventStore | This EventStore |
old | Object | The old date range |
old.startDate | Date | the old start date |
old.endDate | Date | the old end date |
new | Object | The new date range |
new.startDate | Date | the new start date |
new.endDate | Date | the new end date |
changed | Boolean |
|