TaskResize

Feature that allows resizing a task by dragging its end date. Resizing a task by dragging its start date is not allowed.

This feature is enabled by default

This feature updates the event's endDate live in order to leverage the rendering pathway to always yield a correct appearance. The changes are done in batched mode so that changes do not become eligible for data synchronization or propagation until the operation is completed.

Customizing the resize tooltip

To show custom HTML in the tooltip, please see the tooltipTemplate config. Example:

taskResize : {
    // A minimal end date tooltip
    tooltipTemplate : ({ record, endDate }) => {
        return DateHelper.format(endDate, 'MMM D');
    }
}

Configs

27

Common

disabledInstancePlugin
listenersEvents

Other

pinSuccessors: Boolean | String= falseAlso a property

Set to true to enable resizing task while pinning dependent tasks. By default, this behavior is activated if you hold CTRL key during drag. Alternatively, you may provide key name to use. Supported values are:

  • 'ctrl'
  • 'shift'
  • 'alt'
  • 'meta'

Note: Only supported in forward-scheduled project

bottomHandleEventResize
dragThresholdEventResize
leftHandleEventResize
lockLayoutEventResize
reservedSpaceEventResize
resizeSelectedEventResize
rightHandleEventResize
showTooltipEventResize
tipEventResize
tooltipTemplateEventResize
topHandleEventResize
validatorFnEventResize

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Properties

19

Common

disabledInstancePlugin

Class hierarchy

isTaskResize: Boolean= truereadonly
Identifies an object as an instance of TaskResize class, or subclass thereof.
isTaskResize: Boolean= truereadonlystatic
Identifies an object as an instance of TaskResize class, or subclass thereof.
isEventResizeEventResize
isEventsEvents
isInstancePluginInstancePlugin
isLocalizableLocalizable

Other

pinSuccessors: Boolean | StringAlso a config

Gets or sets special key to activate successor pinning behavior. Supported values are:

  • 'ctrl'
  • 'shift'
  • 'alt'
  • 'meta'

Assign false to disable it.

isResizingEventResize
tipEventResize

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Functions

28

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

15

Fires on the owning Gantt before resizing starts. Return false to prevent the operation.

// Adding a listener using the "on" method
taskResize.on('beforeTaskResize', ({ taskRecord, event }) => {

});
ParameterTypeDescription
taskRecordTaskModel
eventEvent

Fires on the owning Gantt to allow implementer to prevent immediate finalization by setting data.context.async = true in the listener, to show a confirmation popup etc.

 gantt.on('beforeTaskResizeFinalize', ({context}) => {
     context.async = true;
     setTimeout(() => {
         // async code don't forget to call finalize
         context.finalize();
     }, 1000);
 })
// Adding a listener using the "on" method
taskResize.on('beforeTaskResizeFinalize', ({ taskRecord, source, context, context.endDate, context.originalEndDate, context.resizeData, event, context.async, context.finalize }) => {

});
ParameterTypeDescription
taskRecordTaskModel
sourceGantt

Gantt instance

contextObject
context.endDateDate

New endDate

context.originalEndDateDate

End date before resize

context.resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true.

eventEvent

Browser event

context.asyncBoolean

Set true to handle resize asynchronously (e.g. to wait for user confirmation)

context.finalizefunction

Call this method to finalize resize. This method accepts one argument: pass true to update records, or false, to ignore changes

Fires on the owning Gantt on each resize move event

// Adding a listener using the "on" method
taskResize.on('taskPartialResize', ({ resizeData, taskRecord, startDate, endDate, element }) => {

});
ParameterTypeDescription
resizeDataTaskResizeData[]

Data for the tasks that are being resized. Only available when resizeSelected is true. The nested properties are same as context

taskRecordTaskModel

Task record being resized

startDateDate

New startDate

endDateDate

New endDate

elementHTMLElement

Fires on the owning Gantt after the resizing gesture has finished.

// Adding a listener using the "on" method
taskResize.on('taskResizeEnd', ({ changed, taskRecord, resizeData }) => {

});
ParameterTypeDescription
changedBoolean
taskRecordTaskModel
resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true

Fires on the owning Gantt when task resizing starts

// Adding a listener using the "on" method
taskResize.on('taskResizeStart', ({ taskRecord, event, resizeData }) => {

});
ParameterTypeDescription
taskRecordTaskModel
eventEvent
resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true

catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin
eventResizeEndEventResize
eventResizeStartEventResize

Event handlers

15

Called on the owning Gantt before resizing starts. Return false to prevent the operation.

new TaskResize({
    onBeforeTaskResize({ taskRecord, event }) {

    }
});
ParameterTypeDescription
taskRecordTaskModel
eventEvent

Called on the owning Gantt to allow implementer to prevent immediate finalization by setting data.context.async = true in the listener, to show a confirmation popup etc.

 gantt.on('beforeTaskResizeFinalize', ({context}) => {
     context.async = true;
     setTimeout(() => {
         // async code don't forget to call finalize
         context.finalize();
     }, 1000);
 })
new TaskResize({
    onBeforeTaskResizeFinalize({ taskRecord, source, context, event }) {

    }
});
ParameterTypeDescription
taskRecordTaskModel
sourceGantt

Gantt instance

contextObject
context.endDateDate

New endDate

context.originalEndDateDate

End date before resize

context.resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true.

eventEvent

Browser event

context.asyncBoolean

Set true to handle resize asynchronously (e.g. to wait for user confirmation)

context.finalizefunction

Call this method to finalize resize. This method accepts one argument: pass true to update records, or false, to ignore changes

Called on the owning Gantt on each resize move event

new TaskResize({
    onTaskPartialResize({ resizeData, taskRecord, startDate, endDate, element }) {

    }
});
ParameterTypeDescription
resizeDataTaskResizeData[]

Data for the tasks that are being resized. Only available when resizeSelected is true. The nested properties are same as context

taskRecordTaskModel

Task record being resized

startDateDate

New startDate

endDateDate

New endDate

elementHTMLElement

Called on the owning Gantt after the resizing gesture has finished.

new TaskResize({
    onTaskResizeEnd({ changed, taskRecord, resizeData }) {

    }
});
ParameterTypeDescription
changedBoolean
taskRecordTaskModel
resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true

Called on the owning Gantt when task resizing starts

new TaskResize({
    onTaskResizeStart({ taskRecord, event, resizeData }) {

    }
});
ParameterTypeDescription
taskRecordTaskModel
eventEvent
resizeDataTaskResizeData[]

Resize data for selected tasks. Only available when resizeSelected is true

onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin
onEventResizeEndEventResize

Typedefs

3

An object containing data related to task resize.

ParameterTypeDescription
taskRecordTaskModel

Task record being resized

startDateDate

New startDate (changed if resizing start side)

endDateDate

New endDate (changed if resizing end side)

originalStartDateDate

Start date before resize

originalEndDateDate

End date before resize

elementHTMLElement

The task element

EventResizeDataEventResize

CSS variables

10

Inherited