ResourceAvatarsItem

Item displaying avatars or initials for a tasks assigned resources.

Resource avatars item
//<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

Common

editor: String | Object= resourcescombo

Widget type or config to use as the editor for this item. Used in the inline task editor.

Defaults to use a ResourcesCombo.

maxAvatars: Number= 7

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.

clsTaskItem
fieldTaskItem
hiddenTaskItem
orderTaskItem
styleTaskItem

Other

overlap: Boolean

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
isResourceAvatarsItem: Boolean= truereadonly
Identifies an object as an instance of ResourceAvatarsItem class, or subclass thereof.
isResourceAvatarsItem: Boolean= truereadonlystatic
Identifies an object as an instance of ResourceAvatarsItem class, or subclass thereof.

Events

2

Fires 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 }) => {

});
ParameterTypeDescription
sourceTaskBoard

The task board

resourceRecordResourceModel

The resource record

taskRecordTaskModel

The task record

eventEvent

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 }) => {

});
ParameterTypeDescription
sourceTaskBoard

The task board

taskRecordTaskModel

The task record

eventEvent

The native DOM event

Event handlers

2

Called on the owning TaskBoard when a resource avatar element is clicked.

new ResourceAvatarsItem({
    onResourceAvatarClick({ source, resourceRecord, taskRecord, event }) {

    }
});
ParameterTypeDescription
sourceTaskBoard

The task board

resourceRecordResourceModel

The resource record

taskRecordTaskModel

The task record

eventEvent

The native DOM event

Called on the owning TaskBoard when a resource avatar overflow element is clicked.

new ResourceAvatarsItem({
    onResourceAvatarOverflowClick({ source, taskRecord, event }) {

    }
});
ParameterTypeDescription
sourceTaskBoard

The task board

taskRecordTaskModel

The task record

eventEvent

The native DOM event

Typedefs

1

CSS variables

7