Agent-readable demo data
- Title
- Touch Event Menus (Open-Source JavaScript Event Calendar) | DayPilot Lite for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Lite
- Description
- Tap a booking’s menu icon to change its confirmation status, rename it, or delete it.
See the Calendar event context menu guide.
Inline demo script 1
(() => {
const calendar = new DayPilot.Calendar("dp", {
viewType: "Day",
startDate: "2026-12-02",
heightSpec: "BusinessHoursNoScroll",
businessBeginsHour: 9,
businessEndsHour: 13,
cellHeight: 34,
eventBorderRadius: 6,
timeFormat: "Clock24Hours",
eventMoveHandling: "Disabled",
eventResizeHandling: "Disabled",
timeRangeSelectedHandling: "Disabled",
events: [
{id: 1, text: "Portrait session", start: "2026-12-02T09:00:00", end: "2026-12-02T10:00:00", confirmed: false},
{id: 2, text: "Equipment pickup", start: "2026-12-02T10:30:00", end: "2026-12-02T11:30:00", confirmed: true}
],
onBeforeEventRender(args) {
const {text, confirmed} = args.data;
const name = DayPilot.Util.escapeHtml(text);
const status = confirmed ? "Confirmed" : "Tentative";
args.data.html = `<div class="booking-name">${name}</div><div class="booking-status">${status}</div>`;
args.data.barColor = confirmed ? "#4b9466" : "#b17a2f";
args.data.backColor = confirmed ? "#eaf6ef" : "#fcf3e5";
args.data.areas = [{
right: 6, top: 4, width: 36, height: 32, padding: 6,
symbol: "../icons/daypilot.svg#threedots-h",
toolTip: "Booking actions",
borderRadius: 4,
backColor: "#f8fbff",
fontColor: "#244a7e",
action: "ContextMenu",
visibility: "TouchVisible"
}];
}
});
const changeStatus = {
text: "Confirm booking",
onClick({source}) {
source.data.confirmed = !source.data.confirmed;
calendar.events.update(source);
}
};
calendar.contextMenu = new DayPilot.Menu({
onShow({source}) {
changeStatus.text = source.data.confirmed ? "Mark as tentative" : "Confirm booking";
},
items: [
changeStatus,
{
text: "Rename",
async onClick({source}) {
const result = await DayPilot.Modal.prompt("Booking name", source.text());
const name = result.result?.trim();
if (result.canceled || !name) {
return;
}
source.text(name);
calendar.events.update(source);
}
},
{text: "Delete", onClick: ({source}) => calendar.events.remove(source)}
]
});
calendar.init();
})();