TaskSegmentResize

Feature that allows resizing a task segment by dragging its end.

Task segments
//<code-header>
fiddle.title = 'Task segments';
//</code-header>
const gantt = new Gantt({
    appendTo  : targetElement,
    height    : 200,
    startDate : '2022-07-25',
    endDate   : '2022-08-01',
    rowHeight : 60,
    project   : new ProjectModel({
        startDate : '2022-07-25',
        events    : [
            {
                id        : 1,
                name      : 'Task A',
                startDate : '2022-07-25',
                duration  : 3,
                segments  : [
                    {
                        startDate : '2022-07-25',
                        duration  : 2
                    },
                    {
                        startDate : '2022-07-28',
                        duration  : 1
                    }
                ]
            },
            {
                id        : 2,
                name      : 'Task B',
                startDate : '2022-07-25',
                duration  : 3,
                segments  : [
                    {
                        startDate : '2022-07-25',
                        duration  : 1
                    },
                    {
                        startDate : '2022-07-27',
                        duration  : 2
                    },
                    {
                        startDate : '2022-07-30',
                        duration  : 1
                    }
                ]
            }
        ]
    })
});

This feature is enabled by default.

Configs

26

Common

disabledInstancePlugin
listenersEvents

Misc

clientInstancePlugin
localeClassLocalizable
localizableLocalizable

Other

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

Properties

19

Common

disabledInstancePlugin

Class hierarchy

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

Lifecycle

configBase

Misc

clientInstancePlugin
localeHelperLocalizable
localeManagerLocalizable

Other

isResizingEventResize
tipEventResize

Functions

28

Configuration

applyDefaultsstaticBase

Events

Lifecycle

destroystaticBase

Misc

doDisableInstancePlugin
initClassstaticBase
isOfTypeNamestaticBase
mixinstaticBase
optionalLstaticLocalizable

Other

LstaticLocalizable
onEvents
relayAllEvents
triggerEvents
unEvents

Events

20

Fired on the owning Gantt before resizing starts. Return false to prevent the action.

// Adding a listener using the "on" method
taskSegmentResize.on('beforeTaskSegmentResize', ({ source, taskRecord, resourceRecord, event }) => {

});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

resourceRecordResourceModel

Resource record the resize starts within

eventMouseEvent

Browser event

Fired 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('beforeTaskSegmentResizeFinalize', ({context}) => {
     context.async = true;
     setTimeout(() => {
         // async code don't forget to call finalize
         context.finalize();
     }, 1000);
 })
// Adding a listener using the "on" method
taskSegmentResize.on('beforeTaskSegmentResizeFinalize', ({ source, context, context.async, context.finalize }) => {

});
ParameterTypeDescription
sourceGantt

Gantt instance

contextObject
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
taskSegmentResize.on('taskSegmentPartialResize', ({ source, taskRecord, startDate, endDate, element }) => {

});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

startDateDate
endDateDate
elementHTMLElement

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

// Adding a listener using the "on" method
taskSegmentResize.on('taskSegmentResizeEnd', ({ source, changed, taskRecord }) => {

});
ParameterTypeDescription
sourceGantt

Gantt instance

changedBoolean

Shows if the record has been changed by the resize action

taskRecordTaskModel

Segment being resized

Fires on the owning Gantt when event resizing starts

// Adding a listener using the "on" method
taskSegmentResize.on('taskSegmentResizeStart', ({ source, taskRecord, resourceRecord, event }) => {

});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

resourceRecordResourceModel

Resource record the resize starts within

eventMouseEvent

Browser event

beforeEventSegmentResizeEventSegmentResize
catchAllEvents
destroyEvents
disableInstancePlugin
enableInstancePlugin
eventResizeEndEventResize
eventResizeStartEventResize
eventSegmentPartialResizeEventSegmentResize
eventSegmentResizeEndEventSegmentResize
eventSegmentResizeStartEventSegmentResize

Event handlers

20

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

new TaskSegmentResize({
    onBeforeTaskSegmentResize({ source, taskRecord, resourceRecord, event }) {

    }
});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

resourceRecordResourceModel

Resource record the resize starts within

eventMouseEvent

Browser event

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('beforeTaskSegmentResizeFinalize', ({context}) => {
     context.async = true;
     setTimeout(() => {
         // async code don't forget to call finalize
         context.finalize();
     }, 1000);
 })
new TaskSegmentResize({
    onBeforeTaskSegmentResizeFinalize({ source, context }) {

    }
});
ParameterTypeDescription
sourceGantt

Gantt instance

contextObject
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 TaskSegmentResize({
    onTaskSegmentPartialResize({ source, taskRecord, startDate, endDate, element }) {

    }
});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

startDateDate
endDateDate
elementHTMLElement

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

new TaskSegmentResize({
    onTaskSegmentResizeEnd({ source, changed, taskRecord }) {

    }
});
ParameterTypeDescription
sourceGantt

Gantt instance

changedBoolean

Shows if the record has been changed by the resize action

taskRecordTaskModel

Segment being resized

Called on the owning Gantt when event resizing starts

new TaskSegmentResize({
    onTaskSegmentResizeStart({ source, taskRecord, resourceRecord, event }) {

    }
});
ParameterTypeDescription
sourceGantt

Gantt instance

taskRecordTaskModel

Segment being resized

resourceRecordResourceModel

Resource record the resize starts within

eventMouseEvent

Browser event

onBeforeEventSegmentResizeEventSegmentResize
onDestroyEvents
onDisableInstancePlugin
onEnableInstancePlugin
onEventResizeEndEventResize
onEventSegmentPartialResizeEventSegmentResize
onEventSegmentResizeEndEventSegmentResize
onEventSegmentResizeStartEventSegmentResize

Typedefs

2

CSS variables

10

Inherited