TemplateItem
Item displaying content generated by a template function, see template
Template item
//<code-header>
fiddle.title = 'Template item';
//</code-header>
const taskBoard = new TaskBoard({
appendTo : targetElement,
features : {
columnToolbars : false
},
bodyItems : {
prio : {
type : 'template',
template : ({ taskRecord }) => `<i class="fa fa-traffic-light"></i> ${taskRecord.prio}`
}
},
columns : [
{ id : 'todo', text : 'Todo', color : 'blue' },
{ id : 'doing', text : 'Doing', color : 'orange' },
{ id : 'done', text : 'Done', color : 'green' }
],
columnField : 'status',
project : {
tasks : [
{
id : 1,
name : 'Go surfing',
status : 'doing',
prio : 'Low'
},
{
id : 2,
name : 'Go skiing',
status : 'done',
prio : 'Medium'
},
{
id : 3,
name : 'Go camping',
status : 'todo',
prio : 'High'
}
]
}
});Configs
8
Configs
8Widget type or config to use as the editor for this item. Used in the inline task editor.
TemplateItems are un-editable by default.
Specify as true to render the template item even if the backing field's value is null or undefined. Useful
for example to display some custom string for null values ("Empty", "Unset" etc.).
const taskBoard = new TaskBoard({
footerItems : {
category : {
type : 'template',
renderNull : true,
template : ({ value }) => value ? value : 'Empty'
}
}
});
template: function
Template function used to generate task content.
Return an HTML string or a DomConfig object from the function:
const taskBoard = new TaskBoard({
bodyItems : {
prio : {
type : 'template',
template : ({ taskRecord }) => `<i class="fa fa-tarffic-light"></i> ${taskRecord.prio}`
}
}
});
| Parameter | Type | Description |
|---|---|---|
taskRecord | TaskModel | Task record |
config | TemplateItemConfig | Item config |
value | Object | Value of the configured field |
clsTaskItem
fieldTaskItem
hiddenTaskItem
orderTaskItem
styleTaskItem
Properties
2
Properties
2Identifies an object as an instance of TemplateItem class, or subclass thereof.
Identifies an object as an instance of TemplateItem class, or subclass thereof.
Typedefs
1
Typedefs
1TaskItemOptionsTaskItem