TimelineViewPresets

Configs

3

Common

An array of ViewPreset config objects which describes the available timeline layouts for this scheduler.

By default, a predefined set is loaded from the PresetManager.

A ViewPreset describes the granularity of the timeline view and the layout and subdivisions of the timeline header.

viewPreset: String | ViewPresetConfig= weekAndDayLetterAlso a property

A string key used to lookup a predefined ViewPreset (e.g. 'weekAndDay', 'hourAndDay'), managed by PresetManager. See PresetManager for more information. Or a config object for a viewPreset.

Options:

  • 'secondAndMinute'
  • 'minuteAndHour'
  • 'hourAndDay'
  • 'dayAndWeek'
  • 'dayAndMonth'
  • 'weekAndDay'
  • 'weekAndMonth',
  • 'monthAndYear'
  • 'year'
  • 'manyYears'
  • 'weekAndDayLetter'
  • 'weekDateAndMonth'
  • 'day'
  • 'week'

If passed as a config object, the settings from the viewPreset with the provided base property will be used along with any overridden values in your object.

To override:

viewPreset : {
  base    : 'hourAndDay',
  id      : 'myHourAndDayPreset',
  headers : [
      {
          unit      : "hour",
          increment : 12,
          renderer  : (startDate, endDate, headerConfig, cellIdx) => {
              return "";
          }
      }
  ]
}

or set a new valid preset config if the preset is not registered in the PresetManager.

When you use scheduler in weekview mode, this config is used to pick view preset. If passed view preset is not supported by weekview (only 2 supported by default - 'day' and 'week') default preset will be used - 'week'.

Scheduled events

Defines how dates will be formatted in tooltips etc. This config has priority over similar config on the view preset. For allowed values see format.

By default, this is ingested from ViewPreset upon change of ViewPreset (Such as when zooming in or out). But Setting this to your own value, overrides that behaviour.

Properties

5

Common

Get the PresetStore created for the Scheduler, or set an array of ViewPreset config objects.

Get/set the current view preset

ParameterTypeDescription
viewPreset.options
viewPreset.options.startDateDate

A new start date for the time axis

viewPreset.options.endDateDate

A new end date for the time axis

viewPreset.options.centerDateDate

Where to center the new time axis

viewPreset.options.scrollPositionNumber

The scroll position to scroll the new time axis to. This takes precedence over any date-scrolling. It is used when partnering two timelines which must be scroll-synced.

Class hierarchy

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

Scheduled events

Defines how dates will be formatted in tooltips etc. This config has priority over similar config on the view preset. For allowed values see format.

By default, this is ingested from ViewPreset upon change of ViewPreset (Such as when zooming in or out). But Setting this to your own value, overrides that behaviour.

Events

2

Fired before the viewPreset is changed.

// Adding a listener using the "on" method
timelineViewPresets.on('beforePresetChange', ({ source, startDate, endDate, from, to }) => {

});
ParameterTypeDescription
sourceScheduler

This Scheduler instance.

startDateDate

The new start date of the timeline.

endDateDate

The new end date of the timeline.

fromViewPreset

The outgoing ViewPreset.

toViewPreset

The ViewPreset being switched to.

Fired after the viewPreset has changed.

// Adding a listener using the "on" method
timelineViewPresets.on('presetChange', ({ source, startDate, centerDate, endDate, from, to }) => {

});
ParameterTypeDescription
sourceScheduler

This Scheduler instance.

startDateDate

The new start date of the timeline.

centerDateDate

The new center date of the timeline.

endDateDate

The new end date of the timeline.

fromViewPreset

The outgoing ViewPreset.

toViewPreset

The ViewPreset being switched to.

Event handlers

2

Called before the viewPreset is changed.

new TimelineViewPresets({
    onBeforePresetChange({ source, startDate, endDate, from, to }) {

    }
});
ParameterTypeDescription
sourceScheduler

This Scheduler instance.

startDateDate

The new start date of the timeline.

endDateDate

The new end date of the timeline.

fromViewPreset

The outgoing ViewPreset.

toViewPreset

The ViewPreset being switched to.

Called after the viewPreset has changed.

new TimelineViewPresets({
    onPresetChange({ source, startDate, centerDate, endDate, from, to }) {

    }
});
ParameterTypeDescription
sourceScheduler

This Scheduler instance.

startDateDate

The new start date of the timeline.

centerDateDate

The new center date of the timeline.

endDateDate

The new end date of the timeline.

fromViewPreset

The outgoing ViewPreset.

toViewPreset

The ViewPreset being switched to.