Resources are organized by building and floor. Use the arrows to expand or collapse groups.
Agent-readable demo data
- Title
- Resource Tree (JavaScript Scheduler) | DayPilot Lite for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Lite
- Description
- Resources are organized by building and floor. Use the arrows to expand or collapse groups.
Inline demo script 1
const dp = new DayPilot.Scheduler("dp", {
startDate: "2026-11-01",
days: 30,
scale: "Day",
timeHeaders: [{groupBy: "Month"}, {groupBy: "Day", format: "d"}],
treeEnabled: true,
treePreventParentUsage: true,
rowHeaderWidth: 180,
heightSpec: "Max",
height: 400,
resources: [
{id: "A", name: "Building A", expanded: true, children: [
{id: "A1", name: "First floor", expanded: true, children: [
{id: 0, name: "Room 101"},
{id: "A102", name: "Room 102"}
]},
{id: "A2", name: "Second floor", children: [
{id: "A201", name: "Room 201"},
{id: "A202", name: "Room 202"}
]}
]},
{id: "B", name: "Building B", children: [
{id: "B1", name: "Meeting room"},
{id: "B2", name: "Training room"}
]}
],
events: [
{id: 1, resource: 0, text: "Planning", start: "2026-11-03", end: "2026-11-06"},
{id: 2, resource: "A102", text: "Workshop", start: "2026-11-05", end: "2026-11-08"},
{id: 3, resource: "A201", text: "Review", start: "2026-11-09", end: "2026-11-12"},
{id: 4, resource: "B1", text: "Team meeting", start: "2026-11-04", end: "2026-11-06"}
],
onTimeRangeSelected: async args => {
const modal = await DayPilot.Modal.prompt("New event name:", "Event");
dp.clearSelection();
if (modal.canceled) {
return;
}
dp.events.add({id: DayPilot.guid(), resource: args.resource, text: modal.result,
start: args.start, end: args.end});
}
});
dp.init();
const app = {
init() {
document.getElementById("expand-all").addEventListener("click", () => dp.rows.expandAll());
document.getElementById("collapse-all").addEventListener("click", () => dp.rows.collapseAll());
}
};
app.init();