GanttBase
A thin base class for Gantt. Does not include any features by default, allowing smaller custom-built bundles if used in place of Gantt.
Configs
225
Configs
225Common
The file name of an image file to use when a resource has no image, or its image cannot be loaded.
A task field (id, wbsCode, sequenceNumber etc) that will be used when displaying and editing linked tasks.
See Keyboard shortcuts for details
Configure as true to make the Gantt read-only, by disabling any UIs for modifying data.
Note that checks MUST always also be applied at the server side.
The path for resource images, used by various widgets such as the resource assignment column.
The path for resource images, used by various widgets such as the resource assignment column.
True to scroll the task bar into view when clicking a cell, you can also pass a scroll config object.
Specify as false to not show unscheduled tasks on the Gantt chart. Unscheduled tasks will be rendered as
an icon
True to toggle the collapsed/expanded state when clicking a parent task bar.
Data
A ProjectModel instance or a config object. The project holds all Gantt data.
Misc
If set to true this will:
- show cost, quantity and rate table columns on the task editor "Resources" tab
- show "Rate table" columns in the assignment column editor picker
- include "Cost" column in the "Add new..." column dropdown list
If set to true this will show a color field in the TaskEdit editor and also a
picker in the TaskMenu. Both enables the user to choose a color which will be
applied to the task bar's background. See TaskModel's eventColor
config.
Other
Set to true for sub tasks to inherit their parent´s eventColor
A callback function or a set of name: value properties to apply on tasks created using the task context menu.
Be aware that name value will be ignored since it's auto generated and may be configured with localization.
Example:
// Object form:
newTaskDefaults : {
duration : 3,
manuallyScheduled : true,
percentDone : 15
}
// Function form:
newTaskDefaults : (targetRecord) => {
return {
duration : targetRecord.duration,
manuallyScheduled : targetRecord.manuallyScheduled
}
}
Set of properties to apply on tasks created using the task context menu
Configure UI transitions for various actions in the grid.
| Parameter | Type | Description |
|---|---|---|
insertRecord | Boolean | Transition record insertions |
removeRecord | Boolean | Transition record removals |
toggleColumn | Boolean | Transition column visibility changes |
expandCollapseColumn | Boolean | Transition parent/group column expand/collapse |
toggleRegion | Boolean | Transition region expand/collapse |
toggleTreeNode | Boolean | Transition tree node expand/collapse |
toggleGroup | Boolean | Transition group expand/collapse |
filterRemoval | Boolean | Transition row removals caused by filtering (under specific conditions) |
removeEvent | Boolean | Transition task removals |
changeEvent | Boolean | Transition task changes |
Scheduled events
Task color used by default. Tasks can specify their own eventColor, which will override this config.
For available standard colors, see EventColor.
Returns dates that will constrain resize and drag operations. The method will be called with the task being dragged.
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The task record being moved or resized. |
Constraining object containing start and end constraints. Omitting either
will mean that end is not constrained. So you can prevent a resize or move from moving before
a certain time while not constraining the end date.
An empty function by default, but provided so that you can override it. This function is called each time a task is rendered into the gantt to render the contents of the task.
Returning a string will display it in the task bar, it accepts both plain text or HTML. It is also possible to return a DOM config object which will be synced to the task bars content.
// using plain string
new Gantt({
taskRenderer : ({ taskRecord }) => StringHelper.encodeHtml(taskRecord.name)
});
// using html string
new Gantt({
taskRenderer : ({ taskRecord }) => StringHelper.xss`${taskRecord.id} <b>${taskRecord.name}</b>`
});
// using DOM config
new Gantt({
taskRenderer({ taskRecord }) {
return {
tag : 'b',
html : StringHelper.encodeHtml(taskRecord.name)
}
}
});
| Parameter | Type | Description |
|---|---|---|
detail | Object | An object containing the information needed to render a Task. |
detail.taskRecord | TaskModel | The task record. |
detail.renderData | Object | An object containing details about the task rendering. |
detail.renderData.cls | DomClassList | String | An object whose property names represent the CSS class names to be added to the tasks's element. Set a property's value to truthy or falsy to add or remove the class name based on the property name. Using this technique, you do not have to know whether the class is already there, or deal with concatenation. |
detail.renderData.style | String | Object<String, String> | Inline styles for the task bar DOM element. Use either 'border: 1px solid black' or { border: '1px solid black' } |
detail.renderData.wrapperCls | DomClassList | String | An object whose property names represent the CSS class names to be added to the event wrapper element. Set a property's value to truthy or falsy to add or remove the class name based on the property name. Using this technique, you do not have to know whether the class is already there, or deal with concatenation. |
detail.renderData.iconCls | DomClassList | String | An object whose property names represent the CSS class names to be added to a task icon element. |
indicators | TimeSpan[] | TimeSpanConfig[] | An array that can be populated with TimeSpan records or their config objects to have them rendered in the task row |
Conflict resolution
Content
CSS
Dates
DOM
Float & align
Layout
Masking
misc
State
Time axis
Tree
Zoom
Properties
214
Properties
214Common
Configure as true to make the Gantt read-only, by disabling any UIs for modifying data.
Note that checks MUST always also be applied at the server side.
True to scroll the task bar into view when clicking a cell, you can also pass a scroll config object.
Specify as false to not show unscheduled tasks on the Gantt chart. Unscheduled tasks will be rendered as
an icon
True to toggle the collapsed/expanded state when clicking a parent task bar.
Class hierarchy
Data
The ProjectModel instance containing the data visualized by the Gantt chart.
Other
Set to true for sub tasks to inherit their parent´s eventColor
Configure UI transitions for various actions in the grid.
| Parameter | Type | Description |
|---|---|---|
insertRecord | Boolean | Transition record insertions |
removeRecord | Boolean | Transition record removals |
toggleColumn | Boolean | Transition column visibility changes |
expandCollapseColumn | Boolean | Transition parent/group column expand/collapse |
toggleRegion | Boolean | Transition region expand/collapse |
toggleTreeNode | Boolean | Transition tree node expand/collapse |
toggleGroup | Boolean | Transition group expand/collapse |
filterRemoval | Boolean | Transition row removals caused by filtering (under specific conditions) |
removeEvent | Boolean | Transition task removals |
changeEvent | Boolean | Transition task changes |
Scheduled events
Task color used by default. Tasks can specify their own eventColor, which will override this config.
For available standard colors, see EventColor.
CSS
Dates
DOM
Infinite scroll
Layout
Misc
Scrolling
Selection
State
Time axis
Tree
Widget hierarchy
Functions
178
Functions
178Feature shortcuts
Returns the dependency record for a DOM element
NOTE: Only available when the Dependencies feature is enabled.
| Parameter | Type | Description |
|---|---|---|
element | HTMLElement | The dependency line element |
The dependency record
Misc
Highlights the elements of the passed task records (or ids). If scrollToClosest is set to true (which it is
by default), the highlighted task element closest to the viewport center will be scrolled into view.
The highlighting will be done by adding the css class b-highlighted to the highlighted task elements. Also,
the css class b-is-highlighting will be added to the TimeAxisSubGrid element.
// Highlight a single task
gantt.highlightTasks({ tasks : 22 });
// Highlight multiple tasks
gantt.highlightTasks({ tasks : [1, 40] });
// Don't scroll to highlighted task and don't un-highlight on click
gantt.highlightTasks({ tasks : 1000, scroll : false, unhighlightOnClick : false });
| Parameter | Type | Description |
|---|---|---|
options | Object | Options config object |
options.tasks | TaskModel | Number | String | TaskModel[] | Number[] | String[] | The task records or ids to highlight. If an empty array is passed, the |
options.scroll | Boolean | BryntumScrollOptions | If |
options.unhighlightOnClick | Boolean | If |
options.unhighlightOthers | Boolean | If |
Removes highlighting from the elements of the passed task records (or ids). If no tasks are passed all highlighted tasks will be un-highlighted.
gantt.unhighlightTasks({ tasks : 22 }); // single task
gantt.unhighlightTasks({ tasks : [1, 40] }); // multiple events
| Parameter | Type | Description |
|---|---|---|
options | Object | Options config object |
options.tasks | TaskModel | Number | String | TaskModel[] | Number[] | String[] | The task records or ids to un-highlight. Omit this to un-highlight all. |
Other
Adds a new milestone task below the passed reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new milestone |
options.data | TaskModelConfig | Data for the new milestone |
A promise which yields the added task
Adds a predecessor task to the passed reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new task |
options.data | TaskModelConfig | Data for the new task |
A promise which yields the added task
Adds a new subtask to the passed reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new subtask |
options.at | start | end | Where to insert the new subtask in the parent's children. |
options.data | TaskModelConfig | Data for the new task |
A promise which yields the added task
Adds a successor task to the passed reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new task |
options.data | TaskModelConfig | Data for the new task |
A promise which yields the added task
Adds a new task above the passed reference task. If no options are provided, the new task will inherit the data from the reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new task |
options.data | TaskModelConfig | Data for the new task |
A promise which yields the added task
Adds a new task below the passed reference task. If no options are provided, the new task will inherit the data from the reference task
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | The reference task record |
options | Object | Options for creating the new task |
options.data | TaskModelConfig | Data for the new task |
A promise which yields the added task
Increase the indentation level of one or more tasks in the tree. Has no effect if TreeGroup has regrouped the tree.
| Parameter | Type | Description |
|---|---|---|
tasks | TaskModel[] | TaskModel | The task(s) to indent. |
A promise which resolves if operation is successful
Decrease the indentation level of one or more tasks in the tree. Has no effect if TreeGroup has regrouped the tree.
| Parameter | Type | Description |
|---|---|---|
tasks | TaskModel[] | TaskModel | The task(s) to outdent. |
A promise which resolves if operation is successful
Configuration
Data
Dates
Events
Getters
Rendering
Rows
Scrolling
Selection
Widget hierarchy
Zoom
Events
74
Events
74Fires when adding a task from the UI to allow data mutation.
// Adding a listener using the "on" method
ganttBase.on('beforeTaskAdd', ({ source, taskRecord }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The task |
Task is released, no longer in view/removed. A good spot for cleaning custom things added in a renderTask
listener up, if needed.
// Adding a listener using the "on" method
ganttBase.on('releaseTask', ({ source, renderData, taskRecord, element }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
renderData | Object | Task render data |
taskRecord | TaskModel | Rendered task |
element | HTMLElement | Task element |
Task is rendered, its element is available in DOM.
// Adding a listener using the "on" method
ganttBase.on('renderTask', ({ source, renderData, taskRecord, element }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
renderData | Object | Task render data |
taskRecord | TaskModel | Rendered task |
element | HTMLElement | Task element |
Triggered when clicking a resource avatar or chip in the cells of the ResourceAssignmentColumn.
// Adding a listener using the "on" method
ganttBase.on('resourceAssignmentClick', ({ source, taskRecord, resourceRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
resourceRecord | ResourceModel | Resource record |
event | Event | Browser event |
Triggered after a click on a task bar.
// Adding a listener using the "on" method
ganttBase.on('taskClick', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered after a rightclick (or long press on a touch device) on a task.
// Adding a listener using the "on" method
ganttBase.on('taskContextMenu', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered after a doubleclick on a task.
// Adding a listener using the "on" method
ganttBase.on('taskDblClick', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered when a keydown event is observed if there are selected tasks.
// Adding a listener using the "on" method
ganttBase.on('taskKeyDown', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
event | KeyboardEvent | Browser event |
Triggered when a keyup event is observed if there are selected tasks.
// Adding a listener using the "on" method
ganttBase.on('taskKeyUp', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
event | KeyboardEvent | Browser event |
Triggered after a mousedown on a task bar.
// Adding a listener using the "on" method
ganttBase.on('taskMouseDown', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered for mouseout from a task.
// Adding a listener using the "on" method
ganttBase.on('taskMouseOut', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered after a mouseover on a task.
// Adding a listener using the "on" method
ganttBase.on('taskMouseOver', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Triggered after a mouseup on a task bar.
// Adding a listener using the "on" method
ganttBase.on('taskMouseUp', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Event handlers
74
Event handlers
74Called when adding a task from the UI to allow data mutation.
new GanttBase({
onBeforeTaskAdd({ source, taskRecord }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The task |
Task is released, no longer in view/removed. A good spot for cleaning custom things added in a renderTask
listener up, if needed.
new GanttBase({
onReleaseTask({ source, renderData, taskRecord, element }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
renderData | Object | Task render data |
taskRecord | TaskModel | Rendered task |
element | HTMLElement | Task element |
Task is rendered, its element is available in DOM.
new GanttBase({
onRenderTask({ source, renderData, taskRecord, element }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
renderData | Object | Task render data |
taskRecord | TaskModel | Rendered task |
element | HTMLElement | Task element |
Called when clicking a resource avatar or chip in the cells of the ResourceAssignmentColumn.
new GanttBase({
onResourceAssignmentClick({ source, taskRecord, resourceRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
resourceRecord | ResourceModel | Resource record |
event | Event | Browser event |
Called after a click on a task bar.
new GanttBase({
onTaskClick({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called after a rightclick (or long press on a touch device) on a task.
new GanttBase({
onTaskContextMenu({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called after a doubleclick on a task.
new GanttBase({
onTaskDblClick({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called when a keydown event is observed if there are selected tasks.
new GanttBase({
onTaskKeyDown({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
event | KeyboardEvent | Browser event |
Called when a keyup event is observed if there are selected tasks.
new GanttBase({
onTaskKeyUp({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | This Gantt |
taskRecord | TaskModel | Task record |
event | KeyboardEvent | Browser event |
Called after a mousedown on a task bar.
new GanttBase({
onTaskMouseDown({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called for mouseout from a task.
new GanttBase({
onTaskMouseOut({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called after a mouseover on a task.
new GanttBase({
onTaskMouseOver({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Called after a mouseup on a task bar.
new GanttBase({
onTaskMouseUp({ source, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | Gantt | The Gantt instance |
taskRecord | TaskModel | The Task record |
event | MouseEvent | The native browser event |
Typedefs
18
Typedefs
18CSS variables
106
CSS variables
106| Name | Description |
|---|---|
--b-gantt-task-padding-inline | Task inline padding (for content in the task bar) |
--b-gantt-task-border-radius | Task border radius |
--b-gantt-parent-task-max-height | Max height for parent tasks. Set to `null` to let them always grow with the height of the row |
--b-gantt-task-font-weight | Task font weight (for content in the task bar) |
--b-gantt-task-font-size | Task font size (for content in the task bar) |
--b-gantt-task-border-width | Task border width. Should always include a unit (e.g. `0px`, not `0`) |
--b-gantt-task-border-style | Task border style |
--b-gantt-task-z-index | Task z-index |
--b-gantt-task-transition | Task transitions that are always applied |
--b-gantt-task-animating-transition | Task transitions that are applied when animating changes |
--b-gantt-task-box-shadow | Task box shadow |
--b-gantt-task-min-width | Task min width |
--b-gantt-task-primary | Task primary color, applied to normal task bars (not milestones or parents). A shade of it is then used for the bar, determined by the current theme & task style |
--b-gantt-parent-task-primary | Parent task primary color |
--b-gantt-milestone-primary | Milestone primary color |
--b-gantt-unscheduled-task-color | Color for the icon used to illustrate unscheduled tasks |
--b-gantt-inactive-cell-color | Cell color for inactive tasks |
--b-gantt-inactive-task-color | Task primary color for inactive tasks |
--b-sch-event-background | Task background color (overridden by event styles). Styling is shared with Scheduler, hence the name |
--b-sch-event-color | Task border color (overridden by event styles). Styling is shared with Scheduler, hence the name / * --b-sch-event-border-color : null */ ** Task text color (overridden by event styles). Styling is shared with Scheduler, hence the name |
| Hovered | |
--b-sch-event-hover-background | Hovered task's background color (overridden by event styles). Styling is shared with Scheduler, hence the name |
| Selected | |
--b-sch-event-selected-background | Selected task's background color (overridden by event styles). Styling is shared with Scheduler, hence the name |