The onBeforeCellRender event handler fires once for every cell during rendering in the monthly calendar. You can use it to customize the cell appearance.
DayPilot.Month.onBeforeCellRender(args)args.cell.start (DayPilot.Date) - cell start (read-only)
args.cell.end (DayPilot.Date) - cell end (read-only)
args.cell.events() - returns an array of overlapping DayPilot.Event objects
args.cell.properties - object with customizable cell properties
Cell properties (args.cell.properties):
areas (array of area objects)
backColor (string) - custom cell background color
backImage (string) - background image URL
backRepeat (string) - CSS background-repeat value
business (boolean) - business/non-business status
cssClass (string) - custom CSS class
disabled (boolean) - disables the cell; available since 2022.2.5287
headerHtml (string) - custom header HTML
headerBackColor (string) - header background color
html (string) - custom cell HTML
The args.cell.properties object is available since 2021.4.5146. In earlier versions, the same properties were available directly on args.cell (for example args.cell.cssClass).
JavaScript
const month = new DayPilot.Month("dp", {
onBeforeCellRender: (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#eeeeee";
}
},
// ...
});
month.init();Angular
<daypilot-month [config]="config"></daypilot-month>config: DayPilot.MonthConfig = {
onBeforeCellRender: (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#eeeeee";
}
},
// ...
};React
<DayPilotMonth
onBeforeCellRender={onBeforeCellRender}
{/* ... */}
/>const onBeforeCellRender = (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#eeeeee";
}
};Vue
<DayPilotMonth
@beforeCellRender="onBeforeCellRender"
<!-- ... -->
/>const onBeforeCellRender = (args) => {
if (args.cell.start.getDayOfWeek() === 6) {
args.cell.properties.backColor = "#eeeeee";
}
};Cell Customization [doc.daypilot.org]