The onBeforeEventRender event is called for each item in the data source (events.list) during loading. You can use it to make adjustments to the data item before it is processed and displayed by the JavaScript Scheduler component.
This event is the main event customization tool.
When setting custom HTML using args.data.html
, make sure that all input values are properly escaped to prevent XSS attacks.
DayPilot.Scheduler.onBeforeEventRender(args)
args.data
- event data (a shallow copy of the original object, with start
and end
converted to DayPilot.Date)
Note: In builds 8.1.1794 and previous the event data object is accessible as args.e
.
Scheduler 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";
},
// ...
}