api.getReactiveState()
Description
Gets the state object with the reactive properties of GanttThis method allows you to subscribe to the returned properties in the same way as actions.
Usage
api.getReactiveState(): object;
Returns
The method returns an object with the following reactive properties:
{
tasks: array,
links: array,
start: Date,
end: Date,
columns: false | array,
scales: array,
scaleHeight: number,
cellWidth: number,
cellHeight: number,
cellBorders: "column" | "full",
lengthUnit: string,
durationUnit: string,
displayMode: "all" | "grid" | "chart",
_compactMode: boolean, // true when container width <= 650px
gridWidth: number,
highlightTime?: (date: Date, unit: "day" | "hour") => string,
taskTypes: array,
zoom: boolean | array,
selected: number | string,
activeTask: number | string,
autoScale: boolean,
scrollTop: number,
scrollLeft: number,
// --- PRO FEATURES ---
history: object, // PRO
undo: boolean, // PRO
baselines: boolean, // PRO
markers: array, // PRO
unscheduledTasks: boolean, // PRO
splitTasks: boolean, // PRO
criticalPath: object, // PRO
schedule: object, // PRO
projectStart: Date, // PRO
projectEnd: Date, // PRO
};
The Gantt properties detailed description you can find here: Gantt properties overview.
State-only properties
history
PRO
The functionality is available in PRO Edition only
history is an object with the number of operations for each undo/redo action:
history: {
undo: number,
redo: number,
};
area
Represents the visible horizontal time range of the Gantt chart.
area: {
start: number, // timestamp (ms) of the first visible date on screen
end: number, // timestamp (ms) of the last visible date on screen
from: number // horizontal scroll offset in pixels from the start of the timeline
};