ProjectModel
This class represents a global project of your TaskBoard - a central place for all data.
It holds and links the stores usually used by TaskBoard:
Loading remote data
const taskBoard = new TaskBoard({
project : {
// Project configuration
}
});
Working with inline data
The project provides an inlineData getter/setter that can be used to manage data from all Project stores at once. Populating the stores this way can be useful if you do not want to use the CrudManager for server communication but instead load data using Axios or similar.
Getting data
const data = taskboard.project.inlineData;
// use the data in your application
Setting data
// Get data from server manually
const data = await axios.get('/project?id=12345');
// Feed it to the project
taskboard.project.inlineData = data;
See also loadInlineData
Getting modifications
const taskBoard = new TaskBoard({
project : {
// Project configuration
}
});
Built-in StateTrackingManager
The project also has a built-in StateTrackingManager (STM for short), that handles undo/redo for the project stores (additional stores can also be added). You can enable it to track all project store changes:
// Turn on auto recording when you create your TaskBoard:
const taskBoard = new TaskBoard({
project : {
stm : {
autoRecord : true
}
}
});
// Undo a transaction
project.stm.undo();
// Redo
project.stm.redo();
Configs
36
Configs
36Inline data
Legacy inline data
Models & Stores
The constructor of the task model class, to be used in the project. Will be set as the modelClass property of the taskStore.
An TaskStore instance or a config object.
The constructor to create a task store instance with. Should be a class, subclassing the TaskStore.
Other
Properties
78
Properties
78Class hierarchy
Inline data
Models & Stores
Editing
JSON
Parent & children
Functions
56
Functions
56Common
JSON
Returns the data from the records of the projects stores, in a format that can be consumed by loadInlineData().
Used by JSON.stringify to correctly convert this project to json.
const project = new ProjectModel({
tasks : [...],
resources : [...],
assignments : [...]
});
const json = project.toJSON();
// Result:
{
tasks : [...],
resources : [...],
assignments : [...]
}
xxData properties are deprecated and will be removed in the future. Use xx instead. For example
tasksData is deprecated, use tasks instead. For now, both naming schemes are included in the data object
Output can be consumed by loadInlineData():
const json = project.toJSON();
// Plug it back in later
project.loadInlineData(json);