ResourceAvatarsItem
Item displaying avatars or initials for a tasks assigned resources.
//<code-header>
fiddle.title = 'Resource avatars item';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
// Url for resource avatar images
resourceImagePath : 'data/Grid/images/transparent-users/',
features : {
columnToolbars : false
},
// Columns to display
columns : [
{ id : 'todo', text : 'Todo', color : 'blue' },
{ id : 'doing', text : 'Doing', color : 'orange' },
{ id : 'done', text : 'Done', color : 'green' }
],
// Field used to pair a task to a column
columnField : 'status',
// Project using inline data
project : {
tasks : [
{ id : 1, name : 'Try TaskBoard', status : 'doing' },
{ id : 2, name : 'Test Scheduler', status : 'done' },
{ id : 3, name : 'Evaluate Gantt', status : 'doing' },
{ id : 4, name : 'Download Grid', status : 'todo' },
{ id : 5, name : 'Install Scheduler Pro', status : 'todo' }
],
resources : [
{ id : 1, name : 'Angelo', image : 'angelo.png' },
{ id : 2, name : 'Celia Smith', image : false },
{ 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 : 2 },
{ id : 3, event : 3, resource : 3 },
{ id : 4, event : 4, resource : 4 },
{ id : 5, event : 5, resource : 1 },
{ id : 6, event : 1, resource : 2 },
{ id : 7, event : 2, resource : 3 },
{ id : 29, event : 3, resource : 1 }
]
}
});Configs
8
Configs
8Common
Widget type or config to use as the editor for this item. Used in the inline task editor.
Defaults to use a ResourcesCombo.
Maximum avatars to display by default. The last avatar will render an overflow indicator if the task has more resources assigned.
const taskBoard = new TaskBoard({
headerItems : {
resources : {
type : 'resourceAvatars',
maxAvatars : 5
}
}
});
Overridden by card size based settings, see ResponsiveCards.
Other
Specify true to slightly overlap avatars for tasks that have multiple resources assigned. By default, they are
displayed side by side.
const taskBoard = new TaskBoard({
footerItems : {
resourceAvatars : {
overlap : true
}
}
});
Properties
2
Properties
2Events
2
Events
2Fires on the owning TaskBoard when a resource avatar element is clicked.
// Adding a listener using the "on" method
resourceAvatarsItem.on('resourceAvatarClick', ({ source, resourceRecord, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The task board |
resourceRecord | ResourceModel | The resource record |
taskRecord | TaskModel | The task record |
event | Event | The native DOM event |
Fires on the owning TaskBoard when a resource avatar overflow element is clicked.
// Adding a listener using the "on" method
resourceAvatarsItem.on('resourceAvatarOverflowClick', ({ source, taskRecord, event }) => {
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The task board |
taskRecord | TaskModel | The task record |
event | Event | The native DOM event |
Event handlers
2
Event handlers
2Called on the owning TaskBoard when a resource avatar element is clicked.
new ResourceAvatarsItem({
onResourceAvatarClick({ source, resourceRecord, taskRecord, event }) {
}
});| Parameter | Type | Description |
|---|---|---|
source | TaskBoard | The task board |
resourceRecord | ResourceModel | The resource record |
taskRecord | TaskModel | The task record |
event | Event | The native DOM event |
Typedefs
1
Typedefs
1CSS variables
7
CSS variables
7| Name | Description |
|---|---|
--b-task-board-resource-avatars-avatar-size | Avatar size |
--b-task-board-resource-avatars-avatar-gap | Gap between avatars |
--b-task-board-resource-avatars-overflow-color | Overflow text color |
--b-task-board-resource-avatars-overflow-background | Overflow background (on top of the last avatar) |
--b-task-board-resource-avatars-overlap | Avatar overlap |
--b-task-board-resource-avatars-justify-content | Avatar item justification |
--b-task-board-resource-avatars-flex | Avatar item flex |