TaskEditor
Popup used to edit tasks. Normally displayed using the TaskEdit feature.
By default, the editor live updates the task being edited. If you prefer to use buttons to save/cancel the edit,
set autoUpdateRecord to false.
Items
By default, it displays the following items:
| Ref | Type | Weight | Comment |
|---|---|---|---|
| name | text | 100 | Task name |
| description | textarea | 200 | Task description |
| resources | resourcescombo | 300 | Assigned resources |
| color | taskcolorcombo | 400 | Task eventColor |
| column | columncombo | 500 | Bound to configured columnField |
| swimlane | swimlanecombo | 600 | Bound to configured swimlaneField |
If configured with autoUpdateRecord: false it also displays a bottom toolbar with the following items:
| Ref | Type | Weight | Comment |
|---|---|---|---|
| saveButton | button | 100 | Save |
| cancelButton | button | 200 | Cancel |
Customization
Popup and its items can be customized through the feature (see TaskEdit fore more info):
//<code-header>
fiddle.title = 'Task editor customized';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
taskEdit : {
// Config used to create the editor
editorConfig : {
// Will make it anchor to the task being edited
centered : false,
// Display it without masking the rest of the page
modal : false
},
// Affect the editors items
items : {
// Change the label for the name field
name : { label : 'Title' },
// Hide description, color and column
description : null,
color : null,
column : null
}
}
},
// Url for resource avatar images
resourceImagePath : 'data/Grid/images/transparent-users/',
// Columns to display
columns : [
'todo',
'doing',
'done'
],
// Field used to pair a task to a column
columnField : 'status',
// Project using inline data
project : {
tasks : [
{ id : 1, name : 'Double click me', status : 'doing' },
{ id : 2, name : 'Or me', status : 'doing' }
],
resources : [
{ id : 1, name : 'Angelo', image : 'angelo.png' },
{ id : 2, name : 'Celia', image : 'celia.png' },
{ id : 3, name : 'Dave', image : 'dave.png' },
{ id : 4, name : 'Emilia', image : 'emilia.png' }
],
assignments : [
{ id : 1, event : 1, resource : 1 },
{ id : 2, event : 2, resource : 3 }
]
}
});Or by subclassing and instructing the feature to display the new editor:
//<code-header>
fiddle.title = 'Task editor subclassed';
//</code-header>
// The if-statement is to make it register only once in the docs browser,
// not needed in an actual application
if (!Widget.resolveType('mytaskeditor', true)) {
// Subclass TaskEditor
class MyTaskEditor extends TaskEditor {
static type = 'mytaskeditor';
static configurable = {
// Changed title
title : 'Custom task editor',
// Will make it anchor to the task being edited
centered : false,
// Display it without masking the rest of the page
modal : false,
items : {
// Change the label for the resources field
resources : { label : 'Assigned' },
// Hide description, color and column
description : null,
color : null,
column : null
}
};
}
// Register the type of the subclass (mytaskeditor)
MyTaskEditor.initClass();
}
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
taskEdit : {
// Use the custom task editor by supplying its type
editorType : 'mytaskeditor'
}
},
// Url for resource avatar images
resourceImagePath : 'data/Grid/images/transparent-users/',
// Columns to display
columns : [
'todo',
'doing',
'done'
],
// Field used to pair a task to a column
columnField : 'status',
// Project using inline data
project : {
tasks : [
{ id : 1, name : 'Double click me', status : 'doing' },
{ id : 2, name : 'Or me', status : 'doing' }
],
resources : [
{ id : 1, name : 'Angelo', image : 'angelo.png' },
{ id : 2, name : 'Celia', image : 'celia.png' },
{ id : 3, name : 'Dave', image : 'dave.png' },
{ id : 4, name : 'Emilia', image : 'emilia.png' }
],
assignments : [
{ id : 1, event : 1, resource : 2 },
{ id : 2, event : 2, resource : 4 }
]
}
});Configs
122
Configs
122Common
By default the editor automatically updates the edited task when a field is changed. Set this to false
to show Save / Cancel buttons and take manual control of the updating.
Center the editor in browser viewport space. Defaults to true for desktop browsers using a pointer device
Shows a tool used to close the editor in the header.
Show an opaque mask below the editor when shown.
Clicking the mask closes the editor.
True to save and close the editor if ENTER is pressed.
(The save part only applies when configured with autoUpdateRecord : false)
Other
Update fields if the record changes
Content
CSS
DOM
Float & align
Layout
misc
Misc
Scrolling
Properties
98
Properties
98Class hierarchy
CSS
DOM
Layout
Misc
Other
State
Widget hierarchy
Functions
75
Functions
75Configuration
Events
Misc
Other
Widget hierarchy
Events
26
Events
26Fires on the owning TaskBoard when user clicks 'Cancel'.
Returning false from a listener prevents canceling and keeps the editor open.
// Adding a listener using the "on" method
taskEditor.on('beforeCancel', ({ source, editor }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
Fires on the owning TaskBoard when user clicks Save, before changes are saved.
Returning false from a listener prevents saving and keeps the editor open.
// Adding a listener using the "on" method
taskEditor.on('beforeSave', ({ source, editor, record, values }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
record | TaskModel | The task record |
values | Object | The task editor field values |
Fires on the owning TaskBoard when user clicks 'Cancel', after the editor closed.
// Adding a listener using the "on" method
taskEditor.on('cancel', ({ source, editor }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
Fires on the owning TaskBoard when user clicks Save, after changes are saved.
// Adding a listener using the "on" method
taskEditor.on('save', ({ source, editor, record, values }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
record | TaskModel | The task record |
values | Object | The task editor field values |
Event handlers
26
Event handlers
26Called on the owning TaskBoard when user clicks 'Cancel'.
Returning false from a listener prevents canceling and keeps the editor open.
new TaskEditor({
onBeforeCancel({ source, editor }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
Called on the owning TaskBoard when user clicks Save, before changes are saved.
Returning false from a listener prevents saving and keeps the editor open.
new TaskEditor({
onBeforeSave({ source, editor, record, values }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
record | TaskModel | The task record |
values | Object | The task editor field values |
Called on the owning TaskBoard when user clicks 'Cancel', after the editor closed.
new TaskEditor({
onCancel({ source, editor }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
Called on the owning TaskBoard when user clicks Save, after changes are saved.
new TaskEditor({
onSave({ source, editor, record, values }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The taskboard |
editor | TaskEditor | The editor |
record | TaskModel | The task record |
values | Object | The task editor field values |