v7.3.0
SupportExamplesFree Trial

Dependencies
Feature

Feature that draws dependencies between events. Uses a DependencyStore to determine which dependencies to draw, if none is defined one will be created automatically. Dependencies can also be specified as scheduler.dependencies, see example below:

const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2018, 4, 6), endDate : new Date(2018, 4, 13), columns : [ { field : 'name', text : 'Name', width : 100 } ], resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2018-05-06', endDate : '2018-05-07' }, { id : 2, resourceId : 1, name : 'Press meeting', startDate : '2018-05-08', endDate : '2018-05-09' }, { id : 3, resourceId : 2, name : 'Audition', startDate : '2018-05-07', endDate : '2018-05-09' }, { id : 4, resourceId : 2, name : 'Script deadline', startDate : '2018-05-11', endDate : '2018-05-11' } ], features : { dependencies : { clickWidth : 15 }, dependencyMenu : true, dependencyEdit : { editorConfig : { items : { // Custom label for the type field typeField : { label : 'Kind' } }, bbar : { items : { // Hiding save button saveButton : { hidden : true } } } } } }, dependencies : [ { id : 1, from : 1, to : 2, cls : 'dev-path' }, { id : 2, from : 2, to : 4 } ] });

Dependencies also work in vertical mode:

const scheduler = new Scheduler({ appendTo : targetElement, height : '22em', startDate : new Date(2022, 4, 1), endDate : new Date(2022, 4, 7), mode : 'vertical', resources : [ { id : 1, name : 'Greta' }, { id : 2, name : 'Ingrid' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2022-05-02', endDate : '2022-05-03' }, { id : 2, resourceId : 1, name : 'Press meeting', startDate : '2022-05-04', endDate : '2022-05-05' }, { id : 3, resourceId : 2, name : 'Audition', startDate : '2022-05-03', endDate : '2022-05-05' } ], features : { dependencies : true, dependencyEdit : true }, dependencies : [ { id : 1, from : 1, to : 2 }, { id : 2, from : 1, to : 3, fromSide : 'right' } ] });

To customize the dependency tooltip, you can use the tooltipTemplate. For example:

const scheduler = new Scheduler({
    features : {
        dependencies : {
            tooltipTemplate(dependencyModel) {
                const { fromEvent, toEvent } = dependencyModel;

return `${fromEvent.name} (${fromEvent.id}) -> ${toEvent.name} (${toEvent.id})`; } } } }

Styling dependency lines

You can easily customize the arrows drawn between events. To change all arrows, apply the following basic SVG CSS:

.b-sch-dependency {
   stroke-width: 2;
   stroke : red;
}

.b-sch-dependency-arrow { fill: red; }

To style an individual dependency line, you can provide a cls in your data:

{
    "id"   : 9,
    "from" : 7,
    "to"   : 8,
    "cls"  : "special-dependency"
}
// Make line dashed
.b-sch-dependency.special-dependency {
   stroke-dasharray: 5, 5;
}

To customize the marker used for the lines (the arrow header), you can supply a SVG path definition to the markerDef config:

CSSHelper.insertRule(`.b-sch-dependency.b-sch-dependency-special { stroke-dasharray: 5, 5; stroke : orange; }`, targetElement.getRootNode()); const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2018, 4, 6), endDate : new Date(2018, 4, 13), columns : [ { field : 'name', text : 'Name', width : 100 } ], features : { dependencies : { // Circular arrow heads (marker) markerDef : 'M 2,3 a 3,3 0 1,0 6,0 a 3,3 0 1,0 -6,0' } }, resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2018-05-06', endDate : '2018-05-07' }, { id : 2, resourceId : 1, name : 'Press meeting', startDate : '2018-05-08', endDate : '2018-05-09' }, { id : 3, resourceId : 2, name : 'Audition', startDate : '2018-05-07', endDate : '2018-05-09' }, { id : 4, resourceId : 2, name : 'Script deadline', startDate : '2018-05-11', endDate : '2018-05-11' } ], dependencies : [ { id : 1, from : 1, to : 2, cls : 'b-sch-dependency-special' }, { id : 2, from : 2, to : 4 } ] });

You can also specify a radius to get lines with rounded "corners", for a less boxy look:

const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2018, 4, 6), endDate : new Date(2018, 4, 13), columns : [ { field : 'name', text : 'Name', width : 100 } ], resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2018-05-06', endDate : '2018-05-07', style : 'border-radius:5px' }, { id : 2, resourceId : 1, name : 'Press meeting', startDate : '2018-05-08', endDate : '2018-05-09', style : 'border-radius:5px' }, { id : 3, resourceId : 2, name : 'Audition', startDate : '2018-05-07', endDate : '2018-05-09', style : 'border-radius:5px' }, { id : 4, resourceId : 2, name : 'Script deadline', startDate : '2018-05-11', endDate : '2018-05-11', style : 'border-radius:5px' } ], features : { dependencies : { radius : 15 } }, dependencies : [ { id : 1, from : 1, to : 3 }, { id : 2, from : 2, to : 4 } ] });

For advanced use cases, you can also manipulate the DomConfig used to create a dependency line in a renderer function.

Adjusting terminals

When hovering an event bar, terminals (connection points) for creating new dependencies are shown. By default, they have a diameter of 12px and are positioned at the edge of the event bar. You can customize this by setting terminalSize and terminalOffset. The example below uses larger terminals offset to outside the event bar:

const scheduler = new Scheduler({ appendTo : targetElement, // makes scheduler as high as it needs to be to fit rows autoHeight : true, startDate : new Date(2023, 4, 7), endDate : new Date(2023, 4, 14), eventStyle : 'outlined', resourceMargin : 20, rowHeight : 70, columns : [ { field : 'name', text : 'Name', width : 100 } ], resources : [ { id : 1, name : 'Bernard' }, { id : 2, name : 'Bianca' } ], events : [ { id : 1, resourceId : 1, name : 'Interview', startDate : '2023-05-08', endDate : '2023-05-09' }, { id : 2, resourceId : 1, name : 'Press meeting', startDate : '2023-05-10', endDate : '2023-05-11' }, { id : 3, resourceId : 2, name : 'Audition', startDate : '2023-05-09', endDate : '2023-05-11' }, { id : 4, resourceId : 2, name : 'Script deadline', startDate : '2023-05-12', endDate : '2023-05-12' } ], features : { dependencies : { terminalSize : 16, terminalOffset : 8, radius : 5 } }, dependencies : [ { id : 1, from : 1, to : 3 } ] });

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

Useful configs and functions

Member Description
dependencyClick Fires when a dependency line is clicked
dependencyDblClick Fires on dependency double-click
dependencyContextMenu Fires on dependency right-click
dependenciesDrawn Fires after all dependency lines are drawn
dependencyMouseOver Fires when pointer enters a dependency

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • baseCls : Stringb-sch-dependency
    private

    The CSS class applied to dependency lines

  • The clickable/touchable width of the dependency line in pixels. Draws an invisible but wider line along the same path as each dependency, making lines much easier to click and tap on touch devices. The tradeoff is that twice as many SVG lines will be drawn, which can affect performance with many visible dependencies. Set to null to disable the wider hit area and only use the visible line width.

    Has a corresponding runtime clickWidth property.

  • Specify false to prevent dependencies from being redrawn during event interaction, such as dragging, resizing or rescheduling through other means, including when events animate into place. This makes interaction smoother, but dependency lines will not be updated until the interaction is finished.

    Has a corresponding runtime drawOnEventInteraction property.

  • Specify false to prevent dependencies from being drawn during scroll, for smoother scrolling in schedules with lots of dependencies. Dependencies will be drawn when scrolling stops instead.

    Has a corresponding runtime drawOnScroll property.

  • Specify false to not enable simple deletion of dependencies by clicking on them.

    Has a corresponding runtime enableDelete property.

  • Specify true to highlight incoming and outgoing dependencies when hovering an event.

    Has a corresponding runtime highlightDependenciesOnEventHover property.

  • noMarkerCls : Stringb-sch-dependency-markerless
    private

    The CSS class applied to a too narrow dependency line (to hide markers)

  • overCls : Stringb-sch-dependency-over
    private

    The CSS class to add to a dependency line when hovering over it

  • removeIconCls : Stringb-icon b-icon-remove-circle

    The CSS class representing a delete icon shown when clicking a dependency line

  • Set to false to not allow creating dependencies

  • Set it to true to allow dependency creation only for parent events (only applies to Scheduler Pro using the NestedEvents feature). Normally the nested event container inside parent events cannot be scrolled when using dependencies, but by enabling this setting and limiting to where dependencies can be drawn scrolling will be enabled.

  • false to require a drop on a target event bar side circle to define the dependency type. If dropped on the event bar, the defaultValue of the DependencyModel type field will be used to determine the target task side.

    Has a corresponding runtime allowDropOnEventBar property.

  • A tooltip config object that will be applied to the dependency creation Tooltip

  • false to not show a tooltip while creating a dependency

  • CSS class used for terminals

  • Where (on event bar edges) to display terminals. The sides are 'start', 'top', 'end' and 'bottom'

  • Set to true to show a tooltip when hovering a dependency line

    Has a corresponding runtime showTooltip property.

  • A tooltip config object that will be applied to the dependency hover tooltip. Can be used to for example customize delay

  • Set to true to show the lag in the tooltip

  • 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.
  • isDependencies : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of Dependencies class, or subclass thereof.
  • isDependencyCreation : Booleantrue
    READONLY
    static
    ADVANCED
    DependencyCreation
    Identifies an object as an instance of DependencyCreation class, or subclass thereof.
  • isDependencyTooltip : Booleantrue
    READONLY
    static
    ADVANCED
    DependencyTooltip
    Identifies an object as an instance of DependencyTooltip 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.
  • properties : Object
    internal
    static
    InstancePlugin

    A class property getter for the default values of internal properties for this class.

  • The clickable/touchable width of the dependency line in pixels. Draws an invisible but wider line along the same path as each dependency, making lines much easier to click and tap on touch devices. The tradeoff is that twice as many SVG lines will be drawn, which can affect performance with many visible dependencies. Set to null to disable the wider hit area and only use the visible line width.

    Has a corresponding clickWidth config.

  • Specify false to prevent dependencies from being redrawn during event interaction, such as dragging, resizing or rescheduling through other means, including when events animate into place. This makes interaction smoother, but dependency lines will not be updated until the interaction is finished.

    Has a corresponding drawOnEventInteraction config.

  • Specify false to prevent dependencies from being drawn during scroll, for smoother scrolling in schedules with lots of dependencies. Dependencies will be drawn when scrolling stops instead.

    Has a corresponding drawOnScroll config.

  • Specify false to not enable simple deletion of dependencies by clicking on them.

    Has a corresponding enableDelete config.

  • Specify true to highlight incoming and outgoing dependencies when hovering an event.

    Has a corresponding highlightDependenciesOnEventHover config.

  • emptyArray : Array
    internal
    READONLY
    InstancePlugin

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    InstancePlugin

    An empty object that can be used as a default value.

  • isDependencies : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of Dependencies class, or subclass thereof.
  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    InstancePlugin
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • false to require a drop on a target event bar side circle to define the dependency type. If dropped on the event bar, the defaultValue of the DependencyModel type field will be used to determine the target task side.

    Has a corresponding allowDropOnEventBar config.

  • A template function that will be called to generate the HTML contents of the dependency creation tooltip. You can return either an HTML string or a DomConfig object.

    Has a corresponding creationTooltipTemplate config.

  • Set to true to show a tooltip when hovering a dependency line

    Has a corresponding showTooltip config.

  • A template function allowing you to configure the contents of the tooltip shown when hovering a dependency line. You can return either an HTML string or a DomConfig object.

    Has a corresponding tooltipTemplate config.

  • config : Object
    READONLY
    ADVANCED
    InstancePlugin

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

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

  • isDestroying : Boolean
    READONLY
    ADVANCED
    InstancePlugin

    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
    InstancePlugin

    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
  • onClassMixedIn( )
    internal
    static
    InstancePlugin

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    InstancePlugin

    Registers this class type with its Factory

  • Deselects the dependency record

  • Redraws dependencies on the next animation frame

  • Aborts dependency creation, removes proxy and cleans up listeners

  • Creates a connector line that visualizes dependency source & target

  • Create a new dependency from source terminal to target terminal

  • Update connector line showing dependency between source and target when mouse moves. Also check if mouse is over a valid target terminal

  • Create a new dependency if mouse release over valid terminal. Hides connector

  • Remove hover styling when mouse leaves terminal. Also hides terminals when mouse leaves one it and not creating a dependency.

  • Start creating a dependency when mouse is pressed over terminal

  • Show terminals when mouse enters event/task element

  • Hide terminals when mouse leaves event/task element

  • Update dependency creation tooltip

  • Remove connector

  • 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
  • Fired when dependencies are rendered

    Note that this event is triggered on the owning widget:

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
  • Called when dependencies are rendered

    Note that this handler is called on the owning widget:

CSS variables

CSS variables that can be set to adjust appearance
Name Description
--b-dependency-color Dependency line color (SVG stroke, also used as fill for markers)
--b-dependency-hover-stroke-width Dependency hover stroke width (SVG)
--b-dependency-stroke-width Dependency stroke width (SVG)
--b-dependency-tooltip-event-background Background of the illustrational events in the dependency tooltip
--b-dependency-tooltip-terminal-color Color of illustrational terminals in the dependency tooltip
--b-dependency-tooltip-terminal-size Size of the illustrational terminals in the dependency tooltip
--b-dependency-zindex Dependencies z-index
Selected
--b-dependency-selected-color Dependency line color for selected dependencies (SVG stroke, also used as fill for markers)
id: dependencies

Source path

Scheduler/feature/Dependencies.js

Demo

examples/dependencies

Contents