Agent-readable demo data
- Title
- 50 columns (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- Read more about fixed column width [doc.daypilot.org].
Inline demo script 1
const dp = new DayPilot.Calendar("dp", {
startDate: DayPilot.Date.today(),
days: 50,
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: modal.result
});
dp.clearSelection();
dp.message("Created");
}
});
dp.init();
const app = {
init() {
this.loadEventData();
},
loadEventData() {
const events = [];
let i = 1;
for (let day = 0; day < 50; day++) {
for (let hour = 8; hour < 19; hour++) {
const e = {
start: DayPilot.Date.today().addDays(day).addHours(hour),
end: DayPilot.Date.today().addDays(day).addHours(hour).addHours(1),
id: DayPilot.guid(),
text: `Event ${i}`
};
events.push(e);
i += 1;
}
}
dp.update({events});
}
};
app.init();