v7.3.0
SupportExamplesFree Trial

TimeSelection
Feature

Feature that allows selection of a time span in the time axis header. When a time span is selected in the header, a timeSelectionChange event is fired.

const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, features : { timeSelection : { headerRenderer({ timeRange }) { return `<span>${DateHelper.format(timeRange.startDate, 'LST')}</span> <span>${DateHelper.format(timeRange.endDate, 'LST')}</span> <i class='fa fa-close' data-btip="Close"></i>`; } } }, viewPreset : 'hourAndDay', startDate : new Date(2022, 4, 8, 8), endDate : new Date(2022, 4, 8, 16), columns : [ { field : 'name', text : 'Name', width : 100 } ], resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' }, { id : 3, name : 'Rolf' }, { id : 4, name : 'Bengt' }, { id : 5, name : 'Penny' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2022-05-08T09:00:00', endDate : '2022-05-08T10:00:00' }, { id : 2, resourceId : 2, name : 'Meeting', startDate : '2022-05-08T13:00:00', endDate : '2022-05-08T15:00:00' }, { id : 3, resourceId : 3, name : 'Future task', startDate : '2022-05-08T09:00:00', endDate : '2022-05-08T11:30:00' } ], bbar : [ { ref : 'selectionLabel', type : 'widget' } ], getAvailableResources(startDate, endDate) { return this.resourceStore.query(resource => this.isDateRangeAvailable(startDate, endDate, null, resource)); }, onTimeSelectionChange({ startDate, endDate }) { const availableResources = startDate ? this.getAvailableResources(startDate, endDate).length : this.resourceStore.count; this.widgetMap.selectionLabel.html = `${availableResources} resources available`; } }); scheduler.features.timeSelection.selectedTimeSpan = { startDate : new Date(2022, 4, 8, 10), endDate : new Date(2022, 4, 8, 13) };

Configuration

You can configure the content of the header element using the headerRenderer function.

Not compatible with the HeaderZoom feature.

This feature is disabled by default. For info on enabling it, see GridFeatures.

Useful configs and functions

Member Description
tooltipTemplate Template for the selection tooltip
headerRenderer Custom renderer for the header highlight
selectedTimeSpan Currently selected time span
timeSelectionChange Fires when time selection changes

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • A Tooltip config object which is applied to the tooltip shown when hovering a TimeRange header element

    Has a corresponding runtime hoverTooltip property.

  • Specify true to enable a drag-drop gesture to select the time span.

    Has a corresponding runtime enableDragSelect property.

  • The selected time span, which can be set using simple startDate and endDate properties

    • startDate : Date

      The start date of the selected time span

    • endDate : Date

      The end date of the selected time span

    Has a corresponding runtime selectedTimeSpan 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 false to disable localization of this object.

  • Properties

    Properties are getters/setters or publicly accessible variables on this class
    • isDelayable : Booleantrue
      READONLY
      static
      ADVANCED
      Delayable
      Identifies an object as an instance of Delayable class, or subclass thereof.
    • isEvents : Booleantrue
      READONLY
      static
      ADVANCED
      Events
      Identifies an object as an instance of Events class, or subclass thereof.
    • isLocalizable : Booleantrue
      READONLY
      static
      ADVANCED
      Localizable
      Identifies an object as an instance of Localizable class, or subclass thereof.
    • isTimeSelection : Booleantrue
      READONLY
      static
      ADVANCED
      Identifies an object as an instance of TimeSelection class, or subclass thereof.
    • A class property getter for the default values of internal properties for this class.

    • Specify true to enable a drag-drop gesture to select the time span.

      Has a corresponding enableDragSelect config.

    • The Tooltip instance shown when hovering a TimeRange header element

      Has a corresponding hoverTooltip config.

    • emptyArray : Array
      internal
      READONLY
      AbstractTimeRanges

      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 AbstractTimeRanges class, or subclass thereof.
    • Identifies an object as an instance of InstancePlugin class, or subclass thereof.
    • isTimeSelection : Booleantrue
      READONLY
      ADVANCED
      Identifies an object as an instance of TimeSelection class, or subclass thereof.
    • config : Object
      READONLY
      ADVANCED
      AbstractTimeRanges

      Returns a copy of the full configuration which was used to configure this object.

    • This property is set to true before the constructor returns.

    • This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

    • client : Widget
      READONLY
      ADVANCED
      AbstractTimeRanges

      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.

    • initClass( )
      static
      ADVANCED
      AbstractTimeRanges

      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

    • doDestroy( )
      internal
      Events

      Auto detaches listeners registered from start, if set as detachable

    • once( )
      private
      Events

      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 code

    Event handlers

    Event handlers are callbacks called as a result of certain actions in this class

    CSS variables

    CSS variables that can be set to adjust appearance
    Name Description
    --b-time-selection-background Time selection body background color
    --b-time-selection-header-background Time selection header background
    --b-time-selection-opacity Time selection body opacity
    id: timeSelection

    Source path

    Scheduler/feature/TimeSelection.js

    Demo

    examples/time-selection

    Contents