TaskMenu
Feature
Displays a context menu for tasks. Items are populated by other features and/or application code.
You can optionally also use a TaskMenuItem button to display the menu.
Default items
These are the default items provided by TaskBoard features:
| Reference | Weight | Feature | Description |
|---|---|---|---|
editTask |
100 | TaskEdit | Open task editor. Hidden when read-only |
resources |
200 | This feature | Assign/unassign resources. Hidden when read-only |
column |
300 | This feature | Move to column. Hidden when read-only |
swimlane |
400 | This feature | Move to swimlane. Hidden when read-only |
removeTask |
500 | This feature | Remove task. Hidden when read-only |
Default items in the menu can be changed or removed and new items can be added. This is handled using the items config of the feature.
Add items
Add menu items for all tasks by adding a key (used as menu item ref) with a config object for a menu item as the value to the items config:
const taskBoard = new TaskBoard({
features : {
taskMenu : {
items : {
flagTask : {
text : 'Flag task',
icon : 'fa fa-fw fa-flag',
onItem({ taskRecord }) {
taskRecord.flagged = true;
}
}
}
}
}
});
Remove items
To remove default items, configure them as null in the items config:
const taskBoard = new TaskBoard({
features : {
taskMenu : {
items : {
removeTask : null,
resources : null
}
}
}
});
Customize items
To customize default items, supply a new config object for them in the items config. It will merge with the default config object:
const taskBoard = new TaskBoard({
features : {
taskMenu : {
items : {
removeTask : {
text : 'Delete card'
}
}
}
}
});
Manipulating items at runtime
Manipulate items for all tasks or specific tasks at runtime by supplying a processItems function:
const taskBoard = new TaskBoard({
features : {
taskMenu : {
// Process items before menu is shown
processItems({ taskRecord, items }) {
// Push an extra item for done tasks
if (taskRecord.status === 'done') {
items.archive = {
text : 'Archive',
icon : 'fa fa-fw fa-archive'
onItem({ taskRecord }) {
taskRecord.archived = true;
}
};
}
// Do not show menu for low prio tasks
if (taskRecord.prio === 'low') {
return false;
}
}
}
}
});
This feature is enabled by default.
Keyboard shortcuts
This feature has the following default keyboard shortcuts:
| Keys | Action | Action description |
|---|---|---|
| Space | showContextMenuByKey | Shows context menu for currently focused task |
| Ctrl+Space | showContextMenuByKey | Shows context menu for currently focused task |
For more information on how to customize keyboard shortcuts, please see our guide.
Configs
Configs are options you supply in a configuration object when creating an instance of this class-
The mouse / touch gesture which should show this context menu (e.g. 'taskClick' or 'taskContextMenu'). Set to
falseto never trigger it from UI.
Properties
Properties are getters/setters or publicly accessible variables on this class-
Identifies an object as an instance of TaskMenu class, or subclass thereof.
-
Identifies an object as an instance of TaskMenu class, or subclass thereof.