DayCellRenderer

Configs

7
dayCellNameFormat: String | function

The DateHelper format string/function to format the day names in the header part of each calendar cell.

ParameterTypeDescription
dateDate

The date to format.

Returns: String -

The formatted date.

dayCellRenderer: function

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.

ParameterTypeDescription
cellDataDayCell

A DayCell object that contains data about the cell..

dayCellDomConfigDomConfig | Object

An object to sync the day cell element.

dayCellDomConfig.classNameObject

An object who's truthy property names will be applied as class names.

dayCellDomConfig.styleObject

A CSS style definition object.

dayCellDomConfig.datasetObject

The DOM data properties to set.

dayCellDomConfig.childrenDomConfig[]

The DomConfig definitions for the content of the cell.

Returns: String | Object | Object[] -

The definition of the cell header content.

emptyCellRenderer: function | Object | String

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.

ParameterTypeDescription
dayCellRendererDayCell

A DayCell object that contains data about the cell.

Returns: DomConfig | null -

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.

ParameterTypeDescription
domConfigDomConfig | Object

A DomConfig config object which is used to create the overflow button.

domConfig.tagString

The tag name of the element to create.

domConfig.classNameObject

An object who's truthy property names will be applied as class names.

domConfig.textString

The inner content of the element. Note that this will be HTML encoded for XSS safety

domConfig.styleObject

A CSS style definition object.

domConfig.datasetObject

The DOM data properties to set.

overflowCountNumber

The number of overflowing events.

Returns: DomConfig | String | null

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,
              }
          }
      }
  }
overflowPopupTrigger: click | mouseover | hover= click

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

Class hierarchy

isDayCellRenderer: Boolean= truereadonly
Identifies an object as an instance of DayCellRenderer class, or subclass thereof.
isDayCellRenderer: Boolean= truereadonlystatic
Identifies an object as an instance of DayCellRenderer class, or subclass thereof.

Other

cellMap: Mapreadonly

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

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

});
ParameterTypeDescription
cellHTMLElement

The day cell for which the overflow popup is going to be shown.

cellDataDayCell

A DayCell object that contains data about the cell.

dateDate

The date which has overflowing events

overflowPopupOverflowPopup

The overflow Popup.

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

});
ParameterTypeDescription
domEventEvent

The triggering DOM event.

dateDate

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

});
ParameterTypeDescription
cellHTMLElement

The day cell for which the overflow popup is going to be shown.

cellDataDayCell

A DayCell object that contains data about the cell.

dateDate

The date which has overflowing events

overflowPopupOverflowPopup

The overflow Popup.

Event handlers

3

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

    }
});
ParameterTypeDescription
cellHTMLElement

The day cell for which the overflow popup is going to be shown.

cellDataDayCell

A DayCell object that contains data about the cell.

dateDate

The date which has overflowing events

overflowPopupOverflowPopup

The overflow Popup.

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

    }
});
ParameterTypeDescription
domEventEvent

The triggering DOM event.

dateDate

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

    }
});
ParameterTypeDescription
cellHTMLElement

The day cell for which the overflow popup is going to be shown.

cellDataDayCell

A DayCell object that contains data about the cell.

dateDate

The date which has overflowing events

overflowPopupOverflowPopup

The overflow Popup.