Agent-readable demo data
- Title
- Column Resizing (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- In the resource calendar mode, you can enable drag and drop calendar column resizing [doc.daypilot.org].
Inline demo script 1
const dp = new DayPilot.Calendar("dp", {
startDate: DayPilot.Date.today().firstDayOfWeek().addDays(1),
viewType: "Resources",
columns: [
{name: "Parent", children: [
{
name: "Big Cars", children: [
{name: "Big Car 1", id: "big1", width: 100},
{name: "Big Car 2", id: "big2", width: 75},
{name: "Big Car 3", id: "big3"},
{name: "Big Car 4", id: "big4"},
{name: "Big Car 5", id: "big5"},
{name: "Big Car 6", id: "big6"},
{name: "Big Car 7", id: "big7"},
{name: "Big Car 8", id: "big8"}
]
},
{
name: "Small Cars", children: [
{name: "Small Car 1", id: "small1"},
{name: "Small Car 2", id: "small2", width: 200},
{name: "Small Car 3", id: "small3"}
]
}
]
},
{name: "Inherited", id: "inherited", width: 200}
],
columnWidthSpec: "Fixed",
columnWidth: 100,
onTimeRangeSelected: async args => {
const modal = await DayPilot.Modal.prompt("New event name:", "Event");
if (modal.canceled) return;
dp.events.add({
start: args.start,
end: args.end,
id: DayPilot.guid(),
resource: args.resource,
text: "Event"
});
dp.clearSelection();
dp.message("Created");
},
columnResizeHandling: "Update",
onColumnResize: args => {
console.log("args", args);
}
});
dp.init();
const app = {
init() {
this.loadEventData();
},
loadEventData() {
const events = [
{
start: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(12),
end: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(15),
id: DayPilot.guid(),
resource: "big1",
text: "Special event"
}
];
dp.update({events});
}
};
app.init();