DayPilot.Calendar.onBeforeCellRender

The onBeforeCellRender event is fired before the calendar cells are rendered. It lets you customize the cell content and appearance.

Declaration

DayPilot.Calendar.onBeforeCellRender(args);

Parameters

  • args.cell.resource (string | number) [read-only]
  • args.cell.start (DayPilot.Date) [read-only]
  • args.cell.end (DayPilot.Date) [read-only]
  • args.cell.properties (object with customizable cell properties)

Cell properties (args.properties):

  • cssClass (string)
  • html (string)
  • backImage (string)
  • backRepeat (string)
  • backColor (string)
  • business (boolean)
  • areas (array of area data objects)
  • disabled (boolean)

The args.properties object is available since 2021.4.5145. In prior versions, these properties are available directly in the args.cell object (e.g. args.cell.cssClass).

Example

dp.onBeforeCellRender = function(args) {
  if (args.cell.start.getHours() === 13) {
      args.cell.properties.backColor = "silver";
  }
};