v7.3.0
SupportExamplesFree Trial

TaskEdit
Feature

Feature that displays a Task editor, allowing users to edit task data. The Task editor is a popup containing tabs with fields for editing task data.

This demo shows the task edit feature, double-click child task bar to start editing:

const schedulerPro = new SchedulerPro({ appendTo : targetElement, flex : '1 0 100%', // Project contains all the data and is responsible for correct scheduling project : { events : [ { id : 1, name : 'Write docs', expanded : true, children : [ { id : 2, name : 'Proof-read docs', startDate : '2017-01-02', endDate : '2017-01-05' }, { id : 3, name : 'Release docs', startDate : '2017-01-09', endDate : '2017-01-10' } ] } ], resources : [ { id : 1, name : 'Albert' }, { id : 2, name : 'Bill' } ], assignments : [ { event : 2, resource : 1 }, { event : 3, resource : 2 } ] }, startDate : new Date(2016, 11, 31), endDate : new Date(2017, 0, 11), height : 250, columns : [ { field : 'name', text : 'Name' } ] });

Customizing tabs and their widgets

To customize tabs you can:

  • Reconfigure built-in tabs by providing override configs in the items config.
  • Remove existing tabs or add your own in the items config.
  • Advanced: Reconfigure the whole editor widget using editorConfig or replace the whole editor using editorClass.

To add extra items to a tab you need to specify items for the tab container.

Note that object notation is used to specify all built-in items in the tabs in the editor, thus object notation has to be used to manipulate them - array notation is not supported.

This demo shows adding of custom widgets to the task editor, double-click child task bar to start editing:

const schedulerPro = new SchedulerPro({ appendTo : targetElement, flex : '1 0 100%', // Project contains all the data and is responsible for correct scheduling project : { events : [ { id : 1, name : 'Write docs', expanded : true, children : [ { id : 2, name : 'Proof-read docs', startDate : '2017-01-02', endDate : '2017-01-05', effort : 0 }, { id : 3, name : 'Release docs', startDate : '2017-01-09', endDate : '2017-01-10', effort : 0 } ] } ], resources : [ { id : 1, name : 'Albert' }, { id : 2, name : 'Bill' } ], assignments : [ { event : 2, resource : 1 }, { event : 3, resource : 2 } ] }, startDate : new Date(2016, 11, 31), endDate : new Date(2017, 0, 11), height : 250, features : { taskEdit : { items : { // add some UI-elements to "General" tab generalTab : { items : { customDivider : { html : '', weight : 610, flex : '1 0 100%' }, // text input field milestoneField : { type : 'text', weight : 611, readOnly : true, editable : false, label : 'My field', name : 'milestone', flex : '1 0 50%' }, // a button customButton : { type : 'button', weight : 612, text : 'Button', flex : '1 0 50%' } } }, // hide "Notes" tab notesTab : false } } }, columns : [ { field : 'name', text : 'Name' } ] });

Expand to see Default tabs and fields

The Task editor contains tabs by default. Each tab contains built-in widgets: text fields, grids, etc.

Tab ref Type Text Weight Description
generalTab SchedulerGeneralTab General 100 Basic fields: name, resources, start/end dates, duration, percent done
predecessorsTab PredecessorsTab Predecessors 200 Shows a grid with incoming dependencies
successorsTab SuccessorsTab Successors 300 Shows a grid with outgoing dependencies
advancedTab SchedulerAdvancedTab Advanced 500 Shows advanced configuration: constraints and manual scheduling mode
notesTab NotesTab Notes 600 Shows a text area to add notes to the selected task

General tab

General tab contains fields for basic configurations

Field ref Type Text Weight Description
nameField TextField Name 100 Task name
resourcesField Combo Resources 200 Shows a list of available resources for this task
startDateField DateTimeField Start 300 Shows when the task begins
endDateField DateTimeField Finish 400 Shows when the task ends
durationField DurationField Duration 500 Shows how long the task is
percentDoneField NumberField % Complete 600 Shows what part of task is done already in percentage
colorField ¹ EventColorField Color ¹ 700 Choose background color for the task bar

¹ Set the showTaskColorPickers config to true to enable this field

Predecessors tab

Predecessors tab contains a grid with incoming dependencies and controls to remove/add dependencies

Widget ref Type Weight Description
grid Grid 100 Shows predecessors task name, dependency type and lag
toolbar Toolbar 200 Shows control buttons
>add Button 210 Adds a new predecessor. Then select a task from the list in the name column editor
>remove Button 220 Removes selected incoming dependency
>
first level of submenu

Successors tab

Successors tab contains a grid with outgoing dependencies and controls to remove/add dependencies

Widget ref Type Weight Description
grid Grid 100 Shows successors task name, dependency type and lag
toolbar Toolbar 200 Shows control buttons
>add Button 210 Adds a new successor. Then select a task from the list in the name column editor
>remove Button 220 Removes selected outgoing dependency
>
first level of submenu

Advanced tab

Advanced tab contains additional task scheduling options

Field ref Type Weight Description
calendarField CalendarField 100 List of available calendars for this task. Shown when calendars are downloaded
constraintTypeField ConstraintTypePicker 200 Shows a list of available constraints for this task
constraintDateField DateField 300 Shows a date for the selected constraint type
manuallyScheduledField Checkbox 400 If checked, the task is not considered in scheduling
inactiveField Checkbox 500 Allows inactivating the task so it won't take part in the scheduling process.
ignoreResourceCalendarField Checkbox 600 If checked the event ignores the assigned resource calendars when scheduling

Notes tab

Notes tab contains a text area to show notes

Field ref Type Weight Description
noteField TextAreaField 100 Shows a text area to add text notes to the task

The built-in buttons are:

Widget ref Type Weight Description
saveButton Button 100 Save event button on the bbar
deleteButton Button 200 Delete event button on the bbar
cancelButton Button 300 Cancel event editing button on the bbar

Removing a built-in item or toolbar button

To remove a built-in toolbar button, tab or field, specify its ref as false in the items config:

const scheduler = new SchedulerPro({
    features : {
        taskEdit : {
            items : {
                generalTab      : {
                    items : {
                        // Remove "Duration" and "% Complete" fields in the "General" tab
                        durationField    : false,
                        percentDoneField : false
                    }
                },
                // Remove all tabs except the "General" tab
                notesTab        : false,
                predecessorsTab : false,
                successorsTab   : false,
                advancedTab     : false
            },
            editorConfig : {
                bbar : {
                    // Remove delete button
                    items : {
                        deleteButton : false
                    }
                }
            }
        }
    }
})

Customizing a built-in item

To customize a built-in tab or field, use its ref as the key in the items config and specify the configs you want to change (they will be merged with the tabs or fields default configs correspondingly):

const scheduler = new SchedulerPro({
    features : {
        taskEdit : {
            items : {
                generalTab      : {
                    // Rename "General" tab
                    title : 'Main',
                    items : {
                        // Rename "% Complete" field
                        percentDoneField : {
                            label : 'Status'
                        }
                    }
                }
            }
        }
    }
})

Adding a custom item

To add a custom tab or field, add an entry to the items config. When you add a field, the name property links the input field to a field in the loaded task record:

const scheduler = new SchedulerPro({
    features : {
        taskEdit : {
            items : {
                generalTab : {
                    items : {
                        // Add new field to the last position
                        newGeneralField : {
                            type   : 'textfield',
                            weight : 610,
                            label  : 'New field in General Tab',
                            // Name of the field matches data field name, so value is loaded/saved automatically
                            name   : 'custom'
                        }
                    }
                },
                // Add a custom tab to the first position
                newTab     : {
                    // Tab is a FormTab by default
                    title  : 'New tab',
                    weight : 90,
                    items  : {
                        newTabField : {
                            type   : 'textfield',
                            weight : 10,
                            label  : 'New field in New Tab',
                            // Name of the field matches data field name, so value is loaded/saved automatically.
                            // In this case it is equal to the Task "name" field.
                            name   : 'name'
                        }
                    }
                }
            }
        }
    }
})

Manipulating TaskEditor items at run time

To change input items depending upon the task being edited, use a beforeTaskEditShow listener to access the editor instance.

The available widgets are described here.

The editor exposes all its descendant widgets in its widgetMap.

const gantt = new Gantt({
    features : {
        taskEdit : true
    },
    listeners : {
        // When editing a parent task, the user may not edit the duration.
        // When editing a leaf level task she may edit the duration.
        beforeTaskEditShow({ taskRecord, editor }) {
            if (taskRecord.isParent) {
                editor.widgetMap.duration.disabled = true;
            }
            else {
                editor.widgetMap.duration.disabled = false;
            }
        }
    }
});

To turn off the Task Editor just simple disable the feature.

const scheduler = new SchedulerPro({
    features : {
        taskEdit : false
    }
})

By default predecessors and successors in successorsTab and predecessorsTab are displayed using task id and a name. The id part is configurable, any task field may be used instead (for example wbsCode or sequence number) by Gantt dependencyIdField property, to set it globally, or using taskEdit config dependencyIdField to set format only for taskEditor.

const gantt = new Gantt({
   dependencyIdField: 'wbsCode', // for global format

project, columns : [ { type : 'name', width : 250 } ], features : { taskEdit : { editorConfig : { dependencyIdField : 'wbsCode' // set only for taskEditor } } } });

For more info on customizing the Task Editor, please see Guides/Customization/Customize task editor

Editing nested events

Note that when editing nested events the resource field, the successors tab and the predecessors tab are hidden automatically.

This feature is disabled by default in SchedulerPro and disabled in ResourceHistogram. For info on enabling it, see GridFeatures.

See also

No results

Configs

Configs are options you supply in a configuration object when creating an instance of this class
  • Set to false to not scroll event into view when invoking edit action (e.g. if event is only partially visible)

  • Class to use as the editor. By default it picks editor class depending on the project type. It can be either SchedulerTaskEditor or GanttTaskEditor. By specifying your own editorClass you override this.

  • Project type to editor class map. Editor will be used depending on project, not on product.

  • True to save and close this panel if ENTER is pressed in one of the input fields inside the panel.

  • triggerEvent : Stringeventdblclick

    The event that shall trigger showing the editor. Defaults to eventdblclick, set to `` or null to disable editing of existing events.

  • True to show a confirmation dialog before deleting the event

  • Internal listeners, that cannot be removed by the user.

  • The widget which this plugin is to attach to.

    Has a corresponding runtime client property.

  • Set to false to disable localization of this object.

  • blurAction : 'cancel'/'save'cancel
    TaskEditBase

    What action should be taken when you click outside the editor, cancel or save

  • When field in task editor is changed, project model normally will trigger hasChanges event. If you use this event to handle project changes excessive events might be a problem. Set this flag to true to only trigger single hasChanges event after task changes are applied.

  • The week start day used in all date fields of the feature editor form by default. 0 means Sunday, 6 means Saturday. Defaults to the locale's week start day.

Properties

Properties are getters/setters or publicly accessible variables on this class
  • isDelayable : Booleantrue
    READONLY
    static
    ADVANCED
    Delayable
    Identifies an object as an instance of Delayable class, or subclass thereof.
  • isEvents : Booleantrue
    READONLY
    static
    ADVANCED
    Events
    Identifies an object as an instance of Events class, or subclass thereof.
  • isLocalizable : Booleantrue
    READONLY
    static
    ADVANCED
    Localizable
    Identifies an object as an instance of Localizable class, or subclass thereof.
  • isTaskEdit : Booleantrue
    READONLY
    static
    ADVANCED
    Identifies an object as an instance of TaskEdit class, or subclass thereof.
  • isTaskEditStm : Booleantrue
    READONLY
    static
    ADVANCED
    TaskEditStm
    Identifies an object as an instance of TaskEditStm class, or subclass thereof.
  • properties : Object
    internal
    static
    InstancePlugin

    A class property getter for the default values of internal properties for this class.

  • emptyArray : Array
    internal
    READONLY
    InstancePlugin

    An empty array that can be used as a default value.

  • emptyObject : Object
    internal
    READONLY
    InstancePlugin

    An empty object that can be used as a default value.

  • isInstancePlugin : Booleantrue
    READONLY
    ADVANCED
    InstancePlugin
    Identifies an object as an instance of InstancePlugin class, or subclass thereof.
  • isTaskEdit : Booleantrue
    READONLY
    ADVANCED
    Identifies an object as an instance of TaskEdit class, or subclass thereof.
  • isTaskEditBase : Booleantrue
    READONLY
    ADVANCED
    TaskEditBase
    Identifies an object as an instance of TaskEditBase class, or subclass thereof.
  • The editor widget used for editing task details. Provides an interface to modify task properties within the Scheduler.

  • config : Object
    READONLY
    ADVANCED
    InstancePlugin

    Returns a copy of the full configuration which was used to configure this object.

  • This property is set to true before the constructor returns.

  • isDestroying : Boolean
    READONLY
    ADVANCED
    InstancePlugin

    This property is set to true on entry to the destroy method. It remains on the objects after returning from destroy(). If isDestroyed is true, this property will also be true, so there is no need to test for both (for example, comp.isDestroying || comp.isDestroyed).

  • client : Widget
    READONLY
    ADVANCED
    InstancePlugin

    The Widget which was passed into the constructor, which is the Widget we are providing extra services for.

    Has a corresponding client config.

  • Get the global LocaleHelper

  • Get the global LocaleManager

  • Returns true if the editor is currently active

Functions

Functions are methods available for calling on the class
  • onClassMixedIn( )
    internal
    static
    InstancePlugin

    This optional class method is called when a class is mixed in using the mixin() method.

  • initClass( )
    static
    ADVANCED
    InstancePlugin

    Registers this class type with its Factory

  • Internal function used to hook destroy() calls when using thisObj

  • Internal function used restore hooked destroy() calls when using thisObj

  • doDestroy( )
    internal
    Events

    Auto detaches listeners registered from start, if set as detachable

  • once( )
    private
    Events

    Internal function used to run a callback function after an event is triggered

  • Removes all listeners registered to this object by the application.

  • This will merge a feature's (subclass of InstancePlugin) keyMap with it's client's keyMap.

Events

Events are triggered for certain actions in this class and can be listened for to react to those actions in your code

Event handlers

Event handlers are callbacks called as a result of certain actions in this class
id: taskEdit

Source path

SchedulerPro/feature/TaskEdit.js

Demo

examples/taskeditor

Contents