Agent-readable demo data

Title
Row Creating (JavaScript Scheduler) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
You can add a new resource using the special row at the bottom. Read more about row creating [doc.daypilot.org].

Inline demo script 1

const dp = new DayPilot.Scheduler("dp", {
            rowCreateHandling: "Enabled",
            onRowCreate: args => {
                dp.resources.push({
                    id: DayPilot.guid(),
                    name: args.text
                });
                dp.update();
            },
            startDate: "2026-01-01",
            days: 365,
            scale: "Day",
            timeHeaders: [
                {groupBy: "Month", format: "MMMM yyyy"},
                {groupBy: "Day", format: "d"}
            ],
            resources: [
                {name: "Room A", id: "A"},
                {name: "Room B", id: "B"},
                {name: "Room C", id: "C"},
                {name: "Room D", id: "D"}
            ],
            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();
        dp.scrollTo("2026-03-25");