DayCellRenderer
Configs
7
Configs
7The DateHelper format string/function to format the day names in the header part of each calendar cell.
| Parameter | Type | Description |
|---|---|---|
date | Date | The date to format. |
The formatted date.
This may be specified to create the content for the date and day name section of calendar cells.
This function is called for each cell rendered. It can return an HTML string which will become the content of the header section of the cell above any events.
It can also return a DomConfig element creation object (or array of same) to specify content to create in the header section of the cell.
It also allows developers to mutate the cell metadata, or the CSS classes to be applied to the cell.
The DomConfig definition passed as the first parameter may be mutated to create a different cell header.
dayCellRenderer : function(cellData, dayCellDomConfig) {
// I don't like Mondays!
if (cellData.day === 1) {
dayCellDomConfig.className['hackathon-dayoff'] = true;
dayCellDomConfig.style.fontWeight = 'bold';
cellData.isNonWorking = true;
return `${cellData.date.getDate()} Day off yay!`;
}
}
A non-null return value from the renderer is used as the content of the day number element.
| Parameter | Type | Description |
|---|---|---|
cellData | DayCell | A |
dayCellDomConfig | DomConfig | Object | An object to sync the day cell element. |
dayCellDomConfig.className | Object | An object who's truthy property names will be applied as class names. |
dayCellDomConfig.style | Object | A CSS style definition object. |
dayCellDomConfig.dataset | Object | The DOM data properties to set. |
dayCellDomConfig.children | DomConfig[] | The DomConfig definitions for the content of the cell. |
The definition of the cell header content.
A DomConfig object which will be used to create the content of a clickable element which is present when no events are in a cell.
Or a function, or name of a function which returns a DomConfig object.
See the emptyCellClick event.
| Parameter | Type | Description |
|---|---|---|
dayCellRenderer | DayCell | A |
DomConfig object representing the HTML markup
How much vertical space in pixels to leave between event bars in a cell.
A function, or name of a function which is passed the DomConfig object which will be used to create the "+n more" button which indicates that a day cell has overflowing events.
overflowButtonRenderer : function(domConfig) {
domConfig.className['fa'] = domConfig.className['fa-list'] = 1;
return domConfig;
}
The result is used to create the overflow button element.
To target the element using custom CSS, use the class name b-cal-cell-overflow.
| Parameter | Type | Description |
|---|---|---|
domConfig | DomConfig | Object | A DomConfig config object which is used to create the overflow button. |
domConfig.tag | String | The tag name of the element to create. |
domConfig.className | Object | An object who's truthy property names will be applied as class names. |
domConfig.text | String | The inner content of the element. Note that this will be HTML encoded for XSS safety |
domConfig.style | Object | A CSS style definition object. |
domConfig.dataset | Object | The DOM data properties to set. |
overflowCount | Number | The number of overflowing events. |
A config object used to create the OverflowPopup that this view may show when events for one day overflow the available space.
For example
modes : {
month : {
overflowPopup : {
closable : false,
dateFormat : 'dddd, MMM M',
eventRenderer({ eventRecord, renderData }) {
if (calendarUtils.isImportantEvent(eventRecord)) {
// Add CSS class to important events
renderData.cls['b-important'] = 1;
}
}
}
}
}
Note that the eventList config may be used
to customize the list of events shown in the popup. You can set its type property
to be a calendar view such as 'dayview' or 'dayagenda' or 'agendaview' to show a
detailed view of the overflowing day's events:
For example:
modes : {
month : {
overflowPopup : {
eventList : {
// Use a DayView to show overflowing events
// Make hours a little smaller to fit more in
type : 'dayview',
dayStartTime : 9,
hourHeight : 30,
}
}
}
}
The pointer gesture which shows the popup containing any overflowing events in the current view.
This means events which will not fit into a MonthView day cell, or all events
for a YearView cell.
Useful values are 'click' (the default), and 'mouseover'
Properties
5
Properties
5Class hierarchy
Other
Yields a Map which contains the cell data for each date in the current view.
This is a Map where the keys are the date strings in the format
YYYY-MM-DD and the values are DayCell objects which contain the data for that cell.
How much vertical space in pixels to leave between event bars in a cell.
The OverflowPopup instance that this view may show when events for one day overflow the available space.
Events
3
Events
3Fired before an OverflowPopup is shown when an a "+ n more" overflow button is activated by an overflowPopupTrigger event.
// Adding a listener using the "on" method
dayCellRenderer.on('beforeShowOverflowPopup', ({ cell, cellData, date, overflowPopup }) => {
});| Parameter | Type | Description |
|---|---|---|
cell | HTMLElement | The day cell for which the overflow popup is going to be shown. |
cellData | DayCell | A |
date | Date | The date which has overflowing events |
overflowPopup | OverflowPopup | The overflow |
Fired when an empty cell content area is clicked on. If the handler returns
false the current pointer event is not processed further.
// Adding a listener using the "on" method
dayCellRenderer.on('emptyCellClick', ({ domEvent, date }) => {
});| Parameter | Type | Description |
|---|---|---|
domEvent | Event | The triggering DOM event. |
date | Date | The date which has no visible events |
Fired after an OverflowPopup has been shown when an a "+ n more" overflow button is activated by an overflowPopupTrigger event.
// Adding a listener using the "on" method
dayCellRenderer.on('showOverflowPopup', ({ cell, cellData, date, overflowPopup }) => {
});| Parameter | Type | Description |
|---|---|---|
cell | HTMLElement | The day cell for which the overflow popup is going to be shown. |
cellData | DayCell | A |
date | Date | The date which has overflowing events |
overflowPopup | OverflowPopup | The overflow |
Event handlers
3
Event handlers
3Called before an OverflowPopup is shown when an a "+ n more" overflow button is activated by an overflowPopupTrigger event.
new DayCellRenderer({
onBeforeShowOverflowPopup({ cell, cellData, date, overflowPopup }) {
}
});| Parameter | Type | Description |
|---|---|---|
cell | HTMLElement | The day cell for which the overflow popup is going to be shown. |
cellData | DayCell | A |
date | Date | The date which has overflowing events |
overflowPopup | OverflowPopup | The overflow |
Called when an empty cell content area is clicked on. If the handler returns
false the current pointer event is not processed further.
new DayCellRenderer({
onEmptyCellClick({ domEvent, date }) {
}
});| Parameter | Type | Description |
|---|---|---|
domEvent | Event | The triggering DOM event. |
date | Date | The date which has no visible events |
Called after an OverflowPopup has been shown when an a "+ n more" overflow button is activated by an overflowPopupTrigger event.
new DayCellRenderer({
onShowOverflowPopup({ cell, cellData, date, overflowPopup }) {
}
});| Parameter | Type | Description |
|---|---|---|
cell | HTMLElement | The day cell for which the overflow popup is going to be shown. |
cellData | DayCell | A |
date | Date | The date which has overflowing events |
overflowPopup | OverflowPopup | The overflow |