Task Properties

On this page you'll find the full list of properties that the task object may include.

The full list of properties of the link object is given in the Link Properties article.

Required properties

These properties will always be defined on the client. Gantt expects the properties to be specified in the task object on data loading but if they are not specified, Gantt will add them by itself. If you remove one of these properties for the loaded tasks, Gantt will start throwing errors.

NameTypeDescription
id string | number The task id, auto-generated if not set
start_date Date The date when a task is scheduled to begin. If not specified, Gantt will calculate it based on the end_date and duration properties.
The property becomes optional when setting unscheduled: true.
end_date Date The date when a task is scheduled to be completed. If not specified, Gantt will calculate it based on the start_date and duration properties.
The property becomes optional when setting unscheduled: true.
duration number The task duration. If not specified, Gantt will calculate it based on the start_date and end_date properties.

Optional properties

These properties may or may not be defined. The default logic and templates of gantt will use these properties if they are defined.

NameTypeDescription
auto_scheduling boolean Defines whether gantt should do auto-scheduling of the task (true or not specified) or not (false)
bar_height number Sets the height of the DOM element of the task in the timeline area
baselines Baseline[] An array with the baselines
calendar_id number | string Sets the id of the custom calendar to be assigned to the task. The name of the property depends on the value of the calendar_property option
color string Sets the color of the task in the timeline area (i.e. sets background-color for the gantt_task_line element of the task)
constraint_date Date The date of the task constraint. It is added to the task object when auto-scheduling with time constraints is enabled. The property isn't used if auto_scheduling_compatibility is enabled.
constraint_type string The type of the task constraint ("asap", "alap", "snet", "snlt", "fnet", "fnlt", "mso", "mfo"). It is added to the task object when auto-scheduling with time constraints is enabled. The property isn't used if auto_scheduling_compatibility is enabled.
deadline Date Specifies the deadline date for the task. A [visual indicator](Extra Elements in Timeline) is displayed in the timeline when this property is set.
editable boolean Defines whether the task can be editable in the read-only Gantt chart. The name of the property depends on the value of the editable_property option
group_id string | number The group's id. It is added to the tasks grouped by some criterion if the property used for grouping tasks (relation_property in the groupBy() method) is specified as an object.
hide_bar boolean Defines whether a task (type:"task") or milestone (type:"milestone") should be hidden in the timeline area
key string | number The key of the group. It is added to the tasks grouped by some criterion if the property used for grouping tasks (relation_property in the groupBy() method) is specified as an array.
It is also added to the tasks with the name of the group (for example, to the "High", "Normal", "Low" tasks if you've grouped tasks by priority. Check the example).
label string The label of the group. It is added to the tasks with the name of the group (for example, if you've grouped tasks by priority, the property will be added to the tasks with "High", "Normal", "Low" names. Check the example).
open boolean Specifies whether the task branch will be opened initially (to show child tasks). To close/open the branch after Gantt initialization, use the related methods: close() and open()
parent number | string The id of the parent task. If the specified parent doesn't exist, the task won't be rendered in the Gantt. The id of the root task is specified by the root_id config.
progress number The task's progress (from 0 to 1)
progressColor string The color of the task progress in the timeline area (i.e. sets background-color for the gantt_task_progress element of the task progress)
readonly boolean Defines whether the task must be readonly. The name of the property depends on the value of the readonly_property option
render string Defines how subtasks of the task must be displayed.
Values: "split" | "".
If set to "split", the subtasks will be displayed in one row. In addition, if you enable the open_split_tasks property, the subtasks will be rendered in one row only if the task is collapsed.
resource Array <string> An array with resources assigned to the task. It is added to the task object when importing data from MS Project/Primavera
rollup boolean Specifies whether a task (type:"task") or milestone (type:"milestone") should appear on the parent projects.
row_height number Sets the height for the task's row
target string The id of the target task. The property displays the same value as the $drop_target property.
The property is added to the task object only if Data Processor is enabled, after the task is updated and data is sent to the server.
text any The name of the task. If necessary you may use any other name for this property.
The property is used in default configurations of different parts of Gantt.
textColor string The color of the task's text in the timeline area (i.e. sets color for the gantt_task_line element of the task)
type string the task type. The available values are stored in the types object:
  • "task" - a regular task (default value).
  • "project" - a task that starts, when its earliest child task starts, and ends, when its latest child ends. The start_date, end_date, duration properties are ignored for such tasks.
  • "milestone" - a zero-duration task that is used to mark out important dates of the project. The duration, progress, end_date properties are ignored for such tasks.
unscheduled boolean Defines whether the task must be unscheduled. By default, the unscheduled task isn't displayed in the timeline area, empty values are displayed in the grid instead of the start and end dates.

Dynamic properties

Dynamic properties are created on the client and represent the current state of a task or a link. They shouldn't be saved to the database, gantt will ignore these properties if they are specified in your JSON/XML.

NameTypeDescription
[resource_property] string | Array <any> The property may have any other name. This property stores the resource id associated with resourceGrid/Timeline/Histogram/Calendar.
$auto_end_date Date A computed end date of the project task from its subtasks. Added and updated when "auto_scheduling" is disabled.
$auto_start_date Date A computed start date of the project task from its subtasks. Added and updated when "auto_scheduling" is disabled.
$calculate_duration boolean A system property that is used in internal calculations.
$custom_data object An object which contains custom properties of a task which were defined in the importFromMSProject() and importFromPrimaveraP6() methods
$dataprocessor_class string A system property which defines whether the task has been updated. It is added to the task object when Data Processor is enabled. If the value of the property is "updated", the task's text will be bold in the grid but it is possible to define your own styles via CSS.
$drop_target string The id of the target task. A temporary property which is added to the task object when dragging the task vertically.
$effective_calendar string The id of the calendar (or resource calendar) assigned to the task. A system property that is used in internal calculations.
$expanded_branch boolean A system property which shows whether the task is visible depending on whether the task's parents are expanded or not. If at least one parent is collapsed, the task won't be visible. The exception is only split tasks (subtasks).
$has_child boolean Defines whether the Gantt should send a request to the server to load the first-level subtasks of the task. The property is used when the branch_loading property is enabled. The name of the property depends on the value of the branch_loading_property option.
$index number The global vertical position of the task. It is bound to the task and changes if the tasks below or above are open or closed. If the parent of the task is collapsed, the property doesn't show the actual position of the task.
$level number The task's level in the tasks hierarchy (zero-based numbering)
$local_index number The vertical position of the task in the branch (under the parent). It isn't bound to the task and doesn't change if the tasks below or above are open or closed as inside the branch as globally. If the parent of the task is collapsed, the property doesn't show the actual position of the task.
$new boolean It is added for a new task when it is created via the createTask() method or via the "+" button. The property is added to the task object when you open the lightbox, and is removed after you save the task.
$no_end boolean Required, a system property which is added to the task object.
True if the end_date property couldn't be calculated (when the start_date property is loaded but there is no duration or end_date one). In this case, you cannot move or resize the task. The end_date property will depend on the end_date of the subtasks (if any). The start_date property will be fixed and won't change. Auto-scheduling won't work for such a task. If the $no_start property is enabled, the task will fully depend on the dates of its subtasks or on the date of the first task.
$no_start boolean Required, a system property which is added to the task object.
True if the start_date property couldn't be calculated (when the end_date property is loaded but there is no duration or start_date one). The start_date property will depend on the start_date of the subtasks (if any) or on the start date of the first task. The end_date property will be fixed and will change only if the start date of the subtasks/first task is bigger than the end date of the task. Auto-scheduling won't work for such a task. If the $no_end property is enabled, the task will fully depend on the dates of its subtasks or on the date of the first task.
$open boolean A system property which specifies whether the task is currently opened (true). If you change the value of the property and re-draw the Gantt, it will open or close the task. To change the state of the task, you may also apply the open() or close() methods.
$raw object An object with original names of task properties which were imported from MS Project / Primavera into the export module (export server). The properties appear in the $raw object while the file is converted into JSON-format but before they are converted into names and format expected by Gantt.
$rendered_at string | number The id of a row the rollup item / split task is rendered at. This is the temporary property which appears in the object of the rollup/split task only when it's been rendering on the page.
$rendered_parent number | string The id of the parent under which the task is rendered (not id of the real parent of the task). The property is used in internal calculations and on tasks' grouping.
$rendered_type string The type of the rendered task (a temporary property).
$resourceAssignments Array <any> An array with ids of resources assigned to the task (a temporary property). But the most actual data is stored in the store of resource assignments not in this property.
$rollup Array <string | number> An array with ids of tasks and milestones which have appeared on the current task
$source Array <string | number> Required, an array with ids of all links that come out of the task
$split_subtask boolean Appears if the task is a subtask of a split task (i.e. arranges in one row with other subtasks)
$target Array <string | number> Required, an array with ids of links that come into task
$transparent boolean A temporary property which is added to the task object when dragging the task vertically. The task looks a little bit transparent in grid on vertical dragging due to this property.
$virtual boolean It is added to the tasks grouped by some criterion. After the grouping is reset, tasks with $virtual: true are removed
$wbs string The WBS code of the task (a temporary property). It is added to the task object after applying the getWBSCode() method. If the value of the code has changed (the task's parent or position has been changed), you need to call the getWBSCode() method again to get the updated value of the code.

Example

var data = {
  tasks:[
        {id:1, text:"Project #1", start_date:"01-04-2020", duration:18},
        {id:2, text:"Task #1", start_date:"02-04-2020", duration:8, parent:1},
        {id:3, text:"Task #2", start_date:"11-04-2020", duration:8, parent:1}
    ],
    links:[]
};
Back to top