DateStoreLazyLoadPlugin

Plugin for Store that handles lazy loading of stores that is dependent on the view's visible time span.

Configs

1
lazyLoad: Boolean | ObjectAlso a property

If set to true, or a config object, this makes the store load new records when needed. When a record that is not already loaded is requested, the requestData function is called. Please read the guide to learn more on how to configure lazy loading.

ParameterTypeDescription
bufferUnitDurationUnit

Used together with bufferAmount to calculate the start and end dates of each load request. The value is added to the current visible start or end date. Defaults to the visible time span length.

bufferAmountNumber

See bufferUnit

dateFormatString

The format used to convert startDate and endDate parameters passed to the load request querystring. Defaults to YYYY-MM-DD (e.g. 2024-03-11). Only used if a readUrl is configured on the store. See DateHelper for details about formatting dates.

loadFullResourceRangeBoolean

If the ResourceStore is not lazy loaded, set this to true to load events, assignments and/or resource time ranges for all resources with every load request.

useResourceIdsBoolean

Set to true to always provide resourceIds in the request params, instead of a resource startIndex and count

Properties

3

Class hierarchy

isDateStoreLazyLoadPlugin: Boolean= truereadonly
Identifies an object as an instance of DateStoreLazyLoadPlugin class, or subclass thereof.
isDateStoreLazyLoadPlugin: Boolean= truereadonlystatic
Identifies an object as an instance of DateStoreLazyLoadPlugin class, or subclass thereof.

Other

lazyLoad: Boolean | ObjectAlso a config

If set to true, or a config object, this makes the store load new records when needed. When a record that is not already loaded is requested, the requestData function is called. Please read the guide to learn more on how to configure lazy loading.

ParameterTypeDescription
bufferUnitDurationUnit

Used together with bufferAmount to calculate the start and end dates of each load request. The value is added to the current visible start or end date. Defaults to the visible time span length.

bufferAmountNumber

See bufferUnit

dateFormatString

The format used to convert startDate and endDate parameters passed to the load request querystring. Defaults to YYYY-MM-DD (e.g. 2024-03-11). Only used if a readUrl is configured on the store. See DateHelper for details about formatting dates.

loadFullResourceRangeBoolean

If the ResourceStore is not lazy loaded, set this to true to load events, assignments and/or resource time ranges for all resources with every load request.

useResourceIdsBoolean

Set to true to always provide resourceIds in the request params, instead of a resource startIndex and count

Functions

3

In an EventStore or ResourceTimeRangeStore which is configured with lazyLoad, the function provided here is called when a combination of the visible date range and the visible range of resources has not yet been loaded. If the ResourceStore is not configured with lazyLoad, the resource range will include all the loaded resources. When implementing this, it is expected that what is returned is an object with a data property containing the records from startDate to endDate for a range of resources starting at startIndex and with the length specified in the count param.

Base implementation does nothing, either use AjaxStore which implements it, or create your own subclass with an implementation.

class MyEventStore extends EventStore {
   async requestData(params){
      const response = await fetch('https://api.bryntum.com/events/?' + new URLSearchParams(params));
      return await response.json();
   }
}
ParameterTypeDescription
optionsObject
options.startDateDate

The start date of the current timespan

options.endDateDate

The end date of the current timespan

options.startIndexNumber

The resource start index

options.countNumber

The resource count

Returns: Promise

Only available if the store is configured as lazyLoad.

The records matching the provided parameters will be removed from the Store and reloaded the next they are needed.

Provide an array of records or record ids, or provide a combination of resource records (or ids) and/or a date range. Do not combine the records params with the resources and startDate and endDate params.

ParameterTypeDescription
optionsObject
options.recordsModel | Number | String | Model[] | Number[] | String[]

The records to unload. Can be a record instance, record id, or an array of record instances or ids.

options.resourcesResourceModel | Number | String | ResourceModel[] | Number[] | String[]

The resources to unload records for. Requires the startDate and endDate params.

options.startDateDate

The start date of the range to unload records for. Requires the endDate param and also the resources param (except for the TimeRangeStore).

options.endDateDate

The end date of the range to unload records for. Requires the startDate param and also the resources param (except for the TimeRangeStore).

loadStoreLazyLoadPlugin

Events

2
lazyLoadEndedStoreLazyLoadPlugin
lazyLoadStartedStoreLazyLoadPlugin

Event handlers

2
onLazyLoadEndedStoreLazyLoadPlugin
onLazyLoadStartedStoreLazyLoadPlugin