DependencyStoreMixin

Configs

1

An array of allowed dependency types. When set, only the specified dependency types can be created. Use values from DependencyModel.Type:

  • 0 - StartToStart (SS)
  • 1 - StartToEnd (SF)
  • 2 - EndToStart (FS)
  • 3 - EndToEnd (FF)
const scheduler = new Scheduler({
    project : {
        dependencyStore : {
            // Only allow Finish-to-Start and Start-to-Start dependencies
            allowedDependencyTypes : [DependencyModel.Type.EndToStart, DependencyModel.Type.EndToEnd]
        }
    }
});

When null (default), all dependency types are allowed.

This config affects:

  • Drag-creating dependencies (invalid types will be rejected)
  • The dependency editor type combo (only allowed types are shown)
  • The Predecessors and Successors tabs in the Task Editor

Properties

3

Class hierarchy

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

Records

Applies a new dataset to the DependencyStore. Use it to plug externally fetched data into the store.

NOTE: References (fromEvent, toEvent) on the dependencies are determined async by a calculation engine. Thus they cannot be directly accessed after assigning the new dataset.

For example:

dependencyStore.data = [{ from, to }];
// dependencyStore.first.fromEvent is not yet available

To guarantee references are available, wait for calculations for finish:

dependencyStore.data = [{ from, to }];
await dependencyStore.project.commitAsync();
// dependencyStore.first.fromEvent is available

Alternatively use loadDataAsync() instead:

await dependencyStore.loadDataAsync([{ from, to }]);
// dependencyStore.first.fromEvent is available

Functions

10

CRUD

Add dependencies to the store.

NOTE: References (fromEvent, toEvent) on the dependencies are determined async by a calculation engine. Thus they cannot be directly accessed after using this function.

For example:

const [dependency] = dependencyStore.add({ from, to });
// dependency.fromEvent is not yet available

To guarantee references are set up, wait for calculations for finish:

const [dependency] = dependencyStore.add({ from, to });
await dependencyStore.project.commitAsync();
// dependency.fromEvent is available (assuming EventStore is loaded and so on)

Alternatively use addAsync() instead:

const [dependency] = await dependencyStore.addAsync({ from, to });
// dependency.fromEvent is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsDependencyModel | DependencyModel[] | DependencyModelConfig | DependencyModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: DependencyModel[] -

Added records

Add dependencies to the store and triggers calculations directly after. Await this function to have up to date references on the added dependencies.

const [dependency] = await dependencyStore.addAsync({ from, to });
// dependency.fromEvent is available (assuming EventStore is loaded and so on)
ParameterTypeDescription
recordsDependencyModel | DependencyModel[] | DependencyModelConfig | DependencyModelConfig[]

Array of records/data or a single record/data to add to store

silentBoolean

Specify true to suppress events

Returns: DependencyModel[] -

Added records

Applies a new dataset to the DependencyStore and triggers calculations directly after. Use it to plug externally fetched data into the store.

await dependencyStore.loadDataAsync([{ from, to }]);
// dependencyStore.first.fromEvent is available
ParameterTypeDescription
dataDependencyModelConfig[]

Array of DependencyModel data objects

Other

Returns dependency model instance linking tasks with given ids. The dependency can be forward (from 1st task to 2nd) or backward (from 2nd to 1st).

ParameterTypeDescription
sourceEventEventModel | String

1st event

targetEventEventModel | String

2nd event

Returns all dependencies for a certain event (both incoming and outgoing)

ParameterTypeDescription
eventEventModel
Returns: DependencyModel[]

Returns a dependency model instance linking given events if such dependency exists in the store. The dependency can be forward (from 1st event to 2nd) or backward (from 2nd to 1st).

ParameterTypeDescription
sourceEventEventModel | String
targetEventEventModel | String

Returns all dependencies highlighted with the given CSS class

ParameterTypeDescription
clsString

Returns true if the specified dependency type is allowed according to the allowedDependencyTypes configuration.

ParameterTypeDescription
typeNumber

Dependency Type

Returns: Boolean

Validation method used to validate a dependency. Override and return true to indicate that an existing dependency between two tasks is valid. For a new dependency being created please see isValidDependencyToCreate.

ParameterTypeDescription
dependencyOrFromIdDependencyModel | TimeSpan | Number | String

The dependency model, the from task/event or the id of the from task/event

toIdTimeSpan | Number | String

To task/event or id thereof if the first parameter is not a dependency record

typeNumber

Dependency Type if the first parameter is not a dependency model instance.

Returns: Boolean

Validation method used to validate a dependency while creating. Override and return true to indicate that a new dependency is valid to be created.

ParameterTypeDescription
fromIdTimeSpan | Number | String

From event/task or id

toIdTimeSpan | Number | String

To event/task or id

typeNumber

Dependency Type

Returns: Boolean