Agent-readable demo data

Title
Event Multi-Resizing (JavaScript Scheduler) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
You can select multiple events (use Ctrl+click) and resize all of them in time at once. Read more about event multi-resizing [doc.daypilot.org].

Inline demo script 1

const dp = new DayPilot.Scheduler("dp", {
            startDate: new DayPilot.Date("2026-03-25").firstDayOfMonth(),
            cellGroupBy: "Month",
            days: new DayPilot.Date("2026-03-25").firstDayOfMonth().daysInMonth(),
            cellDuration: 1440, // one day
            eventClickHandling: "Select",
            treeEnabled: true,
            rowHeaderWidth: 200,
            resources: [
                {name: "Room A", id: "A"},
                {name: "Room B", id: "B"},
                {name: "Room C", id: "C"},
                {name: "Room D", id: "D"},
                {name: "Room E", id: "E"},
                {name: "Room F", id: "F"},
                {name: "Room G", id: "G"},
                {name: "Room H", id: "H"},
                {name: "Room I", id: "I"},
                {name: "Room J", id: "J"}
            ],
            onTimeRangeSelected: args => {
                const name = prompt("New event name:", "Event");
                dp.clearSelection();
                if (!name) return;
                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    resource: args.resource,
                    text: name
                });
                dp.message("Created");
            },
            allowEventOverlap: false,
            allowMultiResize: true,
            onEventResized: args => {
                // Example: dp.message(`Events ${args.multimove.map(item => item.event.id()).join(', ')} resized.`);
            },
            onEventResizing: args => {
                const event2 = args.multiresize.find(info => info.event.data.text === "Event 2");
                if (event2) {
                    event2.start = event2.event.start();
                    event2.end = event2.event.end();
                }
            }
        });
        dp.init();

        const app = {
            init() {
                this.loadEventData();
            },
            loadEventData() {
                // generate and load events
                const events = [];

                for (let i = 0; i < 15; i++) {
                    const durationDays = Math.floor(Math.random() * 6 + 2); // 2 to 7
                    const start = Math.floor(Math.random() * 6) + 2; // 2 to 7

                    const resId = String.fromCharCode(65 + i);

                    const event = {
                        start: new DayPilot.Date("2026-03-02T00:00:00").addDays(start),
                        end: new DayPilot.Date("2026-03-02T00:00:00").addDays(start).addDays(durationDays),
                        id: DayPilot.guid(),
                        resource: resId,
                        text: `Event ${i + 1}`
                    };

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