TaskStore
A class representing the tree of tasks in the Gantt project. An individual task is represented as an instance of the TaskModel class. The store expects the data loaded to be hierarchical. Each parent node should contain its children in a property called 'children'.
const taskStore = new TaskStore({
data : [
{
"id" : 1000,
"name" : "Cool project",
"percentDone" : 50,
"startDate" : "2019-01-02",
"expanded" : true,
"children" : [
{
"id" : 1,
"name" : "A leaf node",
"startDate" : "2019-01-02",
"percentDone" : 50,
"duration" : 10,
}
]
}
]
});
Configs
86
Configs
86Common
Other
Always return changes in increasing WBS order.
Controls behavior of the outdent logic regarding siblings. By default, outdent will move child to be
its parent's sibling and will move all previous siblings to the outdented node's children. Visually, node
will remain in place just changing the level. When set to true only node with its subtree will be
outdented, siblings will not change parent. Visually, node will be moved as last child of the new parent.
Specifies which tree to use to calculate WBS. Ordered tree is unsortable and unfilterable, it always holds complete tree hierarchy. By default, it uses sortable and filterable tree.
Whether to validate the loaded tasks data by checking if it is suitable for pre-rendering. Pre-rendering is activated with the delayCalculation config option, and it allows to improve the perceived loading performance - the tasks are rendered immediately on load, before the initial calculation completes.
For that to be possible, tasks need to have both start date and end date defined in the incoming data package.
If task is not supposed to be rendered (so called "unscheduled" task), it should have the
unscheduled field set to true.
Validation process will only be activated for the first data load and only if more than 1k tasks are loaded.
Validation will check the initial 100 tasks in the dataset and if less than 10 of them don't have enough data
for pre-rendering, validation will pass. Otherwise, validation will issue a console.warn() call
with the text, suggesting to include pre-rendering data in the initial dataset.
Set to 'auto' to automatically update wbsValue as records in the
store are manipulated (e.g., when the user performs drag-and-drop reordering).
In manual mode, the WBS value is initialized as the store loads and only altered implicitly by the indent and outdent methods. The WBS values are otherwise updated only by an explicit call to refreshWbs.
This can also be a WbsMode object that indicates what operations should automatically refresh WBS values.
The operations that trigger WBS refresh can be enabled explicitly in this object, for example:
wbsMode : {
add : true,
remove : true
}
The above is an opt-in list that enable auto WBS refresh for node add and remove operations (these two
operations are associated with dragging to reorder items). No other operation will trigger WBS refresh.
At present, this leaves out only the sort operation, but if new auto-refreshing operations were added
in future releases, those would also not be included.
Alternatively, this object can be an opt-out specification if all values are falsy:
wbsMode : {
sort : false
}
The above two examples are (currently) equivalent in outcome. The choice between opt-in or opt-out form is a matter of convenience as well as future-proofing preference.
The value 'auto' is equivalent to all properties being true.
The value 'manual' (the default) is equivalent to all properties being false.
Advanced
Chained store
Filtering
Models & Stores
Paging
Records
Remote
Tree
Properties
79
Properties
79Common
Class hierarchy
Other
Whether to validate the loaded tasks data by checking if it is suitable for pre-rendering. Pre-rendering is activated with the delayCalculation config option, and it allows to improve the perceived loading performance - the tasks are rendered immediately on load, before the initial calculation completes.
For that to be possible, tasks need to have both start date and end date defined in the incoming data package.
If task is not supposed to be rendered (so called "unscheduled" task), it should have the
unscheduled field set to true.
Validation process will only be activated for the first data load and only if more than 1k tasks are loaded.
Validation will check the initial 100 tasks in the dataset and if less than 10 of them don't have enough data
for pre-rendering, validation will pass. Otherwise, validation will issue a console.warn() call
with the text, suggesting to include pre-rendering data in the initial dataset.
Advanced
CRUD
Filtering
Misc
Models & Stores
Records
Remote
Functions
105
Functions
105Other
Increase the indentation level of one or more tasks in the tree
| Parameter | Type | Description |
|---|---|---|
records | TaskModel | TaskModel[] | The records to indent. |
A promise which yields the result of the operation
Decrease the indentation level of one or more tasks in the tree
| Parameter | Type | Description |
|---|---|---|
records | TaskModel | TaskModel[] | The records to outdent. |
A promise which yields the result of the operation
For each task in this TaskStore, sets the data in the passed baseline index to the current state of the task.
| Parameter | Type | Description |
|---|---|---|
index | Number | The index in the baselines list of the baseline to update. |
Resource
Checks if a date range is allocated or not for a given resource. Will return true if a Resource has its
allowOverlap value set to true.
| Parameter | Type | Description |
|---|---|---|
startDate | Date | The start date |
endDate | Date | The end date |
excludeEvent | TaskModel | TaskModel[] | null | One or several tasks to exclude from the check (or null) |
resourceRecord | ResourceModel | The resource record |
True if the timespan is available for the resource
Configuration
CRUD
Records
Search
Sort, group & filter
Events
46
Events
46Fired before tasks in the tree are indented. Return false from a listener to prevent the indent.
// Adding a listener using the "on" method
taskStore.on('beforeIndent', ({ source, records }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks to be indented |
Fired before tasks in the tree are outdented. Return false from a listener to prevent the outdent.
// Adding a listener using the "on" method
taskStore.on('beforeOutdent', ({ source, records }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks to be outdented |
Fired after tasks in the tree are indented
// Adding a listener using the "on" method
taskStore.on('indent', ({ source, records }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks that were indented |
Fired after tasks in the tree are outdented
// Adding a listener using the "on" method
taskStore.on('outdent', ({ source, records }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks that were outdented |
Event handlers
46
Event handlers
46Called before tasks in the tree are indented. Return false from a listener to prevent the indent.
new TaskStore({
onBeforeIndent({ source, records }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks to be indented |
Called before tasks in the tree are outdented. Return false from a listener to prevent the outdent.
new TaskStore({
onBeforeOutdent({ source, records }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks to be outdented |
Called after tasks in the tree are indented
new TaskStore({
onIndent({ source, records }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks that were indented |
Called after tasks in the tree are outdented
new TaskStore({
onOutdent({ source, records }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskStore | The task store |
records | TaskModel[] | Tasks that were outdented |
Typedefs
10
Typedefs
10An object that describes the actions that should trigger a refreshWbs to
update WBS values. Objects of this type are passed to wbsMode when the simpler
values of 'auto' or (the default) 'manual' are not desired.
The value 'auto' is equivalent to all properties of this object being true.
The value 'manual' is equivalent to all properties of this object being false.
| Parameter | Type | Description |
|---|---|---|
add | Boolean | Set this property to |
remove | Boolean | Set this property to |
sort | Boolean | Set this property to |