Agent-readable demo data
- Title
- Transparent CSS Theme (Monthly Event Calendar) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- You can create a theme using the online DayPilot Theme Designer: http://themes.daypilot.org/
Inline demo script 1
const dp = new DayPilot.Month("dp", {
theme: "month_transparent",
cellMarginBottom: 20,
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(),
text: modal.result
});
dp.message("Created");
},
onBeforeEventRender: args => {
args.data.areas = [
{
right: 2,
top: 2,
width: 20,
height: 20,
padding: 3,
fontColor: "#666666",
backColor: "#ffffff88",
borderRadius: "50%",
toolTip: "Edit",
symbol: "../icons/daypilot.svg#edit",
onClick: async args => {
const form = [
{id: "text", name: "Event Name", type: "text"}
];
const e = args.source;
const modal = await DayPilot.Modal.form(form, e.data);
if (modal.canceled) {
return;
}
dp.events.update(modal.result);
}
}
]
}
});
dp.init();
const app = {
loadData() {
const events = [];
let start = DayPilot.Date.today().firstDayOfMonth();
for (let i = 0; i < 15; i++) {
const add = Math.floor(Math.random() * 2);
// const add = 1;
start = start.addDays(add);
if (start.getDayOfWeek() === 6) {
start = start.addDays(2);
}
if (start.getDayOfWeek() === 0) {
start = start.addDays(1);
}
events.push({
start: start,
end: start.addDays(1),
id: DayPilot.guid(),
text: "Event " + (i + 1)
});
}
dp.update({events});
},
};
app.loadData();