v7.3.0
SupportExamplesFree Trial

DependencyModel

This model represents a dependency between two events, usually added to a DependencyStore.

It is a subclass of the DependencyBaseModel class, which in its turn subclasses Model. Please refer to documentation of those classes to become familiar with the base interface of this class.

Fields and references

A Dependency has a few predefined fields, see Fields below. The name of any fields data source can be customized in the subclass, see the example below. Please also refer to Model for details.

class MyDependency extends DependencyModel {
  static get fields() {
    return [
      { name: 'to', dataSource: 'targetId' },
      { name: 'from', dataSource: 'sourceId' }
    ]);
  }
}

After load and project normalization, these references are accessible (assuming their respective stores are loaded):

  • fromEvent - The event on the start side of the dependency
  • toEvent - The event on the end side of the dependency

Async resolving of references

As described above, a dependency has links to events. These references are populated async, using the calculation engine of the project that the resource via its store is a part of. Because of this asyncness, references cannot be used immediately after modifications:

dependency.from = 2;
// dependency.fromEvent is not yet up to date

To make sure references are updated, wait for calculations to finish:

dependency.from = 2;
await dependency.project.commitAsync();
// dependency.fromEvent is up to date

As an alternative, you can also use setAsync() to trigger calculations directly after the change:

await dependency.setAsync({ from : 2});
// dependency.fromEvent is up to date

See also

No results

Fields

Fields belong to a Model class and define the Model data structure
  • The calendar of the dependency used to take lag duration into account.

  • Set to false to ignore this dependency in scheduling

  • Bidirectional, drawn with arrows in both directions

  • From event, id of source event

  • fromSide : 'top'/'left'/'bottom'/'right'
    DependencyBaseModel

    Start side on source (top, left, bottom, right)

  • The magnitude of this dependency's lag (the number of units).

  • To event, id of target event

  • toSide : 'top'/'left'/'bottom'/'right'
    DependencyBaseModel

    End side on target (top, left, bottom, right)

  • Dependency type, see static property Type

  • CSS class to apply to lines drawn for the dependency

  • Start expanded or not (only valid for tree data)

  • This is a read-only field provided in server synchronization packets to specify which position the node takes in the parent's ordered children array. This index is set on load and gets updated on reordering nodes in tree. Sorting and filtering have no effect on it.

  • parentId : String/Number/null
    READONLY
    TreeNode

    This is a read-only field provided in server synchronization packets to specify which record id is the parent of the record.

  • This is a read-only field provided in server synchronization packets to specify which position the node takes in the parent's children array. This index is set on load and gets updated automatically after row reordering, sorting, etc. To save the order, need to persist the field on the server and when data is fetched to be loaded, need to sort by this field.

  • Deprecated:

    This field has been deprecated. Please read the guide to find out if your app needs to use the new isFullyLoaded field.

    This field is added to the class at runtime when the Store is configured with lazyLoad. The number specified should reflect the total amount of children of a parent node, including nested descendants.

Configs

Configs are options you supply in a configuration object when creating an instance of this class

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isDependencyModel : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of DependencyModel class, or subclass thereof.
  • isModelStm : Booleantrue
    READONLY
    static
    ADVANCED
    ModelStm
    Identifies an object as an instance of ModelStm class, or subclass thereof.
  • isPartOfProject : Booleantrue
    READONLY
    static
    ADVANCED
    PartOfProject
    Identifies an object as an instance of PartOfProject class, or subclass thereof.
  • isTreeNode : Booleantrue
    READONLY
    static
    ADVANCED
    TreeNode
    Identifies an object as an instance of TreeNode class, or subclass thereof.
  • A class property getter for the default values of internal properties for this class.

  • An enumerable object, containing names for the dependency types integer constants.

    • 0 StartToStart
    • 1 StartToEnd
    • 2 EndToStart
    • 3 EndToEnd
  • An array containing all the defined fields for this Model class. This will include all superclass's defined fields.

  • fieldMap : Object<String, DataField>
    READONLY
    static
    DependencyBaseModel

    An object containing all the defined fields for this Model class. This will include all superclass's defined fields through its prototype chain. So be aware that Object.keys and Object.entries will only access this class's defined fields.

  • The data source for the id field which provides the ID of instances of this Model.

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
    DependencyBaseModel

    Registers this class type with its Factory

  • Makes getters and setters for related records. Populates a Model#relation array with the relations, to allow it to be modified later when assigning stores.

  • Cancels current batch operation. Any changes during the batch are discarded.

  • Reverts changes in this back to their original values.

  • Called from insertChild to notify StateTrackingManager about children insertion. Provides it with all necessary context information collected in beforeInsertChild required to undo/redo the action.

  • Called from removeChild to notify StateTrackingManager about children removing. Provides it with all necessary context information collected in beforeRemoveChild required to undo/redo the action.

  • Called during creation to also turn any children into Models joined to the same stores as this model

  • Initializes model relations. Called from store when adding a record.

  • clear( )
    private
    TreeNode

    Removes all records from the rootNode

Source path

SchedulerPro/model/DependencyModel.js

Contents