Labels
//<code-header>
fiddle.title = 'Labels';
//</code-header>
targetElement.innerHTML = '<p>Demo displaying top and bottom labels with top label; editable on <code>dblclick</code>:</p>';
const scheduler = new Scheduler({
appendTo : targetElement,
// makes scheduler as high as it needs to be to fit rows
autoHeight : true,
barMargin : 5,
rowHeight : 70,
features : {
labels : {
top : {
field : 'location',
editor : {
type : 'textfield'
}
},
bottom : {
renderer : ({ eventRecord }) => `ID: ${eventRecord.id}`
}
}
},
startDate : new Date(2018, 4, 6),
endDate : new Date(2018, 4, 13),
columns : [
{ field : 'name', text : 'Name', width : 100 }
],
resources : [
{ id : 1, name : 'Bernard' },
{ id : 2, name : 'Bianca' }
],
events : [
{ id : 1, resourceId : 1, name : 'Interview', location : 'Office', startDate : '2018-05-07', endDate : '2018-05-10' },
{ id : 2, resourceId : 2, name : 'Meeting', location : `Client's office`, startDate : '2018-05-10', endDate : '2018-05-12' }
]
});Text in labels can be set from a field on the EventModel or the ResourceModel or using a custom renderer. See SchedulerLabelConfig for configuration specification.
new Scheduler({
features : {
labels : {
// Label rendered above the event bar with content from the
// record's location field
top : {
field : 'location',
editor : {
type : 'textfield'
}
},
// Label rendered below the event bar with custom content
// from a renderer
bottom : {
renderer : ({ eventRecord }) => `ID: ${eventRecord.id}`
}
}
}
});
Since top and bottom labels occupy space that would otherwise be used by the event we recommend using bigger
rowHeights (>55px for both labels with default styling) and zero barMargins because top/bottom labels give space
around events anyway.
To prevent labels from being overlapped by other events, see labelLayoutMode.
This feature is disabled by default. It is not supported in vertical mode. For info on enabling it, see GridFeatures.
Configs
19
Configs
19Other
Configuration object for the label which appears after the event bar in the current writing direction.
Configuration object for the label which appears before the event bar in the current writing direction.
What action should be taken when focus moves leaves the cell editor, for example when clicking outside.
May be 'complete' or 'cancel'.
Bottom label configuration object.
Factor representing the average char width in pixels used to determine label width when configured
with labelLayoutMode: 'estimate'.
CSS class to apply to label elements
How to handle labels during event layout. Options are:
- default - Labels do not affect event layout, events will overlap labels
- estimate - Label width is estimated by multiplying text length with labelCharWidth
- measure - Label width is determined by measuring the label, precise but slow
Note that this only applies to the left and right labels, top and bottom labels does not take part in the event layout process.
Left label configuration object.
Right label configuration object.
Top label configuration object.
Misc
Properties
15
Properties
15Common
Class hierarchy
Other
Functions
28
Functions
28Configuration
Events
Misc
Other
Events
5
Events
5Event handlers
5
Event handlers
5Typedefs
2
Typedefs
2Configuration object for a label used by the Labels feature.
| Parameter | Type | Description |
|---|---|---|
field | String | The name of a field in one of the associated records, EventModel or ResourceModel. The record from which the field value is drawn will be ascertained by checking for field definitions by the specified name. |
renderer | function | A function, which when passed an object containing |
renderer.eventRecord | EventModel | |
renderer.resourceRecord | ResourceModel | |
renderer.assignmentRecord | AssignmentModel | |
renderer.domConfig | DomConfig | The DomConfig object representing the label element |
thisObj | Object | The |
editor | InputFieldConfig | Field | If the label is to be editable, a field configuration object with a
|
CSS variables
6
CSS variables
6| Name | Description |
|---|---|
--b-event-label-font-size | Label font size |
--b-event-label-font-weight | Label font weight |
--b-event-label-gap | Gap between label and event bar |
--b-event-label-color | Label color |
--b-event-label-background | Label background |
| Selected | |
--b-selected-event-label-color | Label color when event is selected |