Agent-readable demo data

Title
Event Customization (JavaScript Scheduler) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
Read more about event customization [doc.daypilot.org].

Inline demo script 1

const dp = new DayPilot.Scheduler("dp", {
            // behavior and appearance
            cellWidth: 80,
            eventHeight: 40,

            // view
            startDate: new DayPilot.Date("2026-03-01"),
            days: new DayPilot.Date("2026-03-01").daysInMonth(),
            scale: "Day",
            timeHeaders: [
                {groupBy: "Month"},
                {groupBy: "Day", format: "d"}
            ],
            resources: [
                {name: "Room A", id: "A"},
                {name: "Room B", id: "B"},
                {name: "Room C", id: "C"}
            ],
            onBeforeEventRender: args => {
                if (args.e.type === "disabled") {
                    args.e.barColor = "#9a0";
                    args.e.barBackColor = "#ac0";
                    args.e.moveDisabled = true;
                    args.e.bubbleHtml = "Moving of this event is disabled.";
                    args.e.areas = [{html: "Disabled", right: 2, bottom: 2}];
                }
            },
            onTimeRangeSelected: async args => {
                const modal = await DayPilot.Modal.prompt("New event name:", "Event");
                dp.clearSelection();
                if (modal.canceled) {
                    return;
                }
                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    resource: args.resource,
                    text: modal.result
                });
                dp.message("Created");
            }
        });
        dp.init();

        const app = {
            init() {
                this.loadEventData();
            },
            loadEventData() {
                // generate and load events
                const events = [
                    {
                        start: "2026-03-02T12:00:00",
                        end: "2026-03-05T12:00:00",
                        id: 1,
                        resource: "A",
                        text: "Event 1",
                        type: "disabled"
                    },
                    {
                        start: "2026-03-01T00:00:00",
                        end: "2026-03-06T00:00:00",
                        id: 2,
                        resource: "B",
                        text: "Event 1"
                    }
                ];

                dp.update({events});
            }
        };
        app.init();