v7.3.0

TimeRanges
Feature

Feature that renders global ranges of time in the timeline. Use this feature to visualize a range like a 1 hr lunch or some important point in time (a line, i.e. a range with 0 duration). This feature can also show a current time indicator if you set showCurrentTimeLine to true. To style the rendered elements, use the cls field of the TimeSpan class.

Each time range is represented by an instances of TimeSpan, held in a simple Store. The feature uses timeRangeStore defined on the project by default. The store's persisting/loading is handled by Crud Manager (if it's used by the component).

Note that the feature uses virtualized rendering, only the currently visible ranges are available in the DOM.

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

Showing an icon in the time range header

You can use Font Awesome icons easily (or set any other icon using CSS) by using the iconCls field. The JSON data below will show a flag icon:

{
    "id"        : 5,
    "iconCls"   : "fa fa-flag",
    "name"      : "v5.0",
    "startDate" : "2019-02-07 15:45"
},

Recurring time ranges

The feature supports recurring ranges in case the provided store and models have RecurringTimeSpansMixin and RecurringTimeSpan mixins applied:

// We want to use recurring time ranges, so we make a special model extending standard TimeSpan model with
// RecurringTimeSpan which adds recurrence support
class MyTimeRange extends RecurringTimeSpan(TimeSpan) {}

// Define a new store extending standard Store with RecurringTimeSpansMixin mixin to add recurrence support to the // store. This store will contain time ranges. class MyTimeRangeStore extends RecurringTimeSpansMixin(Store) { static configurable = { // use our new MyResourceTimeRange model modelClass : MyTimeRange } };

// Instantiate store for timeRanges using our new classes const timeRangeStore = new MyTimeRangeStore({ data : [{ id : 1, resourceId : 'r1', startDate : '2019-01-01T11:00', endDate : '2019-01-01T13:00', name : 'Lunch', // this time range should repeat every day recurrenceRule : 'FREQ=DAILY' }] });

const scheduler = new Scheduler({ ... features : { timeRanges : true },

crudManager : { // store for "timeRanges" feature timeRangeStore } });

Useful configs and functions

Member Description
showCurrentTimeLine Show a line indicating current time
currentDateFormat Date format for the current time header
currentTimeLineUpdateInterval Interval for updating the current time line
dragTipTemplate Template for the drag tooltip
currentTimelineUpdate Fires when the current time line updates

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • The date format to show in the header for the current time line (when showCurrentTimeLine is configured). See DateHelper for the possible formats to use.

  • The interval (as amount of ms) defining how frequently the current timeline will be updated

Properties

Properties are getters/setters or publicly accessible variables on this class
  • Returns the TimeRanges which occur within the client Scheduler's time axis.

  • isTimeRanges : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of TimeRanges class, or subclass thereof.
  • store : Store
    READONLY

    Returns the Store used by this feature. This is always the owning Scheduler/Gantt's Project TimeRangeStore.

Functions

Functions are methods available for calling on the class

    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-current-time-color Current time background & line color
    --b-time-range-background Time range background color
    --b-time-range-color Time range color
    --b-time-range-header-background Time range header background
    --b-time-range-header-font-size Time range header font size
    --b-time-range-header-font-weight Time range header font weight
    --b-time-range-header-gap Gap inside time range headers
    --b-time-range-label-font-size Time range label font size
    --b-time-range-label-offset Time range label offset from the line
    --b-time-range-line-color Time range line color
    --b-time-range-line-header-background Time range line header background color
    --b-time-range-line-header-border-radius Time range line header border radius
    --b-time-range-line-header-padding-inline Time range line header padding inline
    --b-time-range-line-label-background Time range line label background color
    --b-time-range-line-label-border-radius Time range line label border radius
    --b-time-range-line-label-color Time range line label color
    --b-time-range-line-label-font-size Time range line label font size
    --b-time-range-line-label-offset Time range line label offset
    --b-time-range-line-label-padding Time range line label padding
    --b-time-range-line-opacity Time range line opacity
    --b-time-range-line-primary Time range lines primary color
    --b-time-range-line-style Time range line style
    --b-time-range-line-width Time range line width
    --b-time-range-line-zindex Time line z-index
    --b-time-range-opacity Time range opacity
    --b-time-range-range-zindex Time range z-index
    id: timeRanges

    Source path

    Scheduler/feature/TimeRanges.js

    Demo

    examples/timeranges

    Contents