DayPilot.Scheduler.onBeforeEventRender

The onBeforeEventRender event handler 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.

Declaration

DayPilot.Scheduler.onBeforeEventRender(args)

Parameters

Notes

In builds 8.1.1794 and earlier, the event data object is accessible as args.e.

Example

Scheduler config:

const dp = new DayPilot.Scheduler("dp", {
  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";
  }
});
dp.init();

See Also

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript