The onBeforeEventRender event is fired before the JavaScript Calendar renders an event. It lets you customize the event properties dynamically.
When setting custom HTML using args.data.html
, make sure that all input values are properly escaped to prevent XSS attacks.
DayPilot.Calendar.onBeforeEventRender(args);
args.control
- DayPilot.Calendar reference; available since 2023.3.5716
args.data
- a shallow copy of the raw event data object, with start
and end
converted to DayPilot.Date
Calendar config:
{
onBeforeEventRender: (args) => {
const text = DayPilot.Util.escapeHtml(args.data.text);
const start = args.data.start.toString("h:mm tt");
const end = args.data.end.toString("h:mm tt");
args.data.html = `${text} (${start} - ${end})`;
args.data.cssClass = "test";
},
// ...
}