ColumnToolbars
Adds toolbars to the top and/or bottom of each column. By default it adds a bottom toolbar containing a single button for adding events to that column/swimlane:
//<code-header>
fiddle.title = 'Column toolbars';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : true
},
// Swimlanes to display
swimlanes : [
'high',
'low'
],
swimlaneField : 'prio',
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{ id : 1, name : 'Easter campaign', status : 'doing', prio : 'high' },
{ id : 2, name : 'Follow up', status : 'done', prio : 'low' },
{ id : 3, name : 'Adjust ads', status : 'doing', prio : 'low' },
{ id : 4, name : 'Spring campaign', status : 'todo', prio : 'low' },
{ id : 5, name : 'Survey', status : 'todo', prio : 'low' }
]
}
});To add, remove or modify toolbar items for all columns, see topItems and bottomItems:
//<code-header>
fiddle.title = 'Column toolbars add';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : {
// By default it displays a bottom toolbar (bbar) with an add button.
// Here we also add a top toolbar with the same button
topItems : {
addTask : true
},
// And add a remove all button to the bottom
bottomItems : {
removeAll : {
icon : 'fa-trash',
tooltip : 'Remove tasks in the column',
onClick : 'up.onRemoveAllClick'
}
}
}
},
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{ id : 1, name : 'Easter campaign', status : 'doing', prio : 'high' },
{ id : 2, name : 'Follow up', status : 'done', prio : 'low' },
{ id : 3, name : 'Adjust ads', status : 'doing', prio : 'low' },
{ id : 4, name : 'Spring campaign', status : 'todo', prio : 'low' },
{ id : 5, name : 'Survey', status : 'todo', prio : 'low' }
]
},
onRemoveAllClick({ source }) {
taskBoard.project.taskStore.remove(source.columnRecord.tasks);
}
});To have per column/swimlane control over the items, see processItems:
//<code-header>
fiddle.title = 'Column toolbars process';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : {
// Using processItems it is possible to affect the items at runtime.
// We use it here to hide the add task button in the Done column
processItems({ items, columnRecord }) {
if (columnRecord.id === 'done') {
items.addTask = false;
}
}
}
},
columns : [
'todo',
'doing',
'done'
],
columnField : 'status',
project : {
tasks : [
{ id : 1, name : 'Easter campaign', status : 'doing', prio : 'high' },
{ id : 2, name : 'Follow up', status : 'done', prio : 'low' },
{ id : 3, name : 'Adjust ads', status : 'doing', prio : 'low' },
{ id : 4, name : 'Spring campaign', status : 'todo', prio : 'low' },
{ id : 5, name : 'Survey', status : 'todo', prio : 'low' }
]
},
onRemoveAllClick({ source }) {
taskBoard.project.taskStore.remove(source.columnRecord.tasks);
}
});In handlers for buttons etc, you can access which column/swimlane the action was taken in on the supplied source
param, using its columnRecord and swimlaneRecord properties:
new TaskBoard({
features : {
columnToolbars : {
topItems : {
clearButton : {
icon : 'fa-trash',
onClick({ source }) {
if (source.columnRecord) {
...
}
}
}
}
}
}
});
This feature is enabled by default.
Configs
12
Configs
12Other
Items to add to the bottom toolbar, in object format.
To remove existing items, set corresponding keys to null.
new TaskBoard({
features : {
columnToolbars : {
bottomItems : {
clearButton : {
icon : 'fa-trash',
onClick : ...
}
}
}
}
});
A function called before displaying the toolbar that allows manipulations of its items.
Returning false from this function prevents the menu being shown.
features : {
columnToolbars : {
processItems({ items, location, columnRecord, swimlaneRecord }) {
// Add or hide existing items here as needed
items.myAction = {
text : 'Cool action',
icon : 'fa-ban',
onClick : () => console.log(`Clicked button for ${columnRecord.text}`)
};
if (columnRecord.id === 'done') {
items.addTask = false
}
}
}
},
| Parameter | Type | Description |
|---|---|---|
context | Object | An object with information about the toolbar being shown |
context.feature | ColumnToolbars | A reference to this feature. |
context.items | Object<String, ContainerItemConfig> | An object containing the toolbar item configs keyed by ref |
context.location | top | bottom | Toolbar location, "top" or "bottom" |
context.columnRecord | ColumnModel | Record representing toolbars column |
context.swimlaneRecord | SwimlaneModel | Record representing toolbars swimlane |
Returning false from this function prevents the menu being shown
Items to add to the top toolbar, in object format.
new TaskBoard({
features : {
columnToolbars : {
topItems : {
clearButton : {
icon : 'fa-trash',
onClick : ...
}
}
}
}
});
Misc
Properties
16
Properties
16Common
Class hierarchy
Other
Functions
28
Functions
28Configuration
Events
Misc
Other
Events
5
Events
5Event handlers
5
Event handlers
5Typedefs
1
Typedefs
1CSS variables
2
CSS variables
2| Name | Description |
|---|---|
--b-task-board-column-toolbars-color | Primary color for buttons in column toolbars |
--b-task-board-column-toolbars-font-size | Font size for buttons in column toolbars |