Two
crosshair modes are
supported: "Header" (headers only) and "Full" (full crosshair).
Crosshair type:
Agent-readable demo data
- Title
- Crosshair (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- Two crosshair modes are
supported: "Header" (headers only) and "Full" (full crosshair).
Inline demo script 1
const dp = new DayPilot.Calendar("dp", {
crosshairType: "Full",
viewType: "Week",
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(),
resource: args.resource,
text: "Event"
});
dp.message("Created");
}
});
dp.init();
const app = {
init() {
const options = document.querySelectorAll("input[name='crosshair']");
options.forEach(e => {
e.addEventListener("change", () => {
const value = document.querySelector("input[name='crosshair']:checked").value;
dp.crosshairType = value;
});
});
}
};
app.init();