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].
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("2027-08-25").firstDayOfMonth(),
cellGroupBy: "Month",
days: new DayPilot.Date("2027-08-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: async (args) => {
const modal = await DayPilot.Modal.prompt("New event name:", "Event");
const name = modal.canceled ? null : modal.result;
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,
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 = [];
const resourceIds = dp.rows
.all()
.map((row) => row.id)
.filter((id) => /^[A-Z]$/.test(id));
for (let i = 0; i < resourceIds.length; 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 = resourceIds[i];
const event = {
start: new DayPilot.Date("2027-08-02T00:00:00").addDays(start),
end: new DayPilot.Date("2027-08-02T00:00:00").addDays(start).addDays(durationDays),
id: DayPilot.guid(),
resource: resId,
text: `Event ${i + 1}`
};
events.push(event);
}
dp.update({events});
}
};
app.init();