Agent-readable demo data
- Title
- Split Resources (JavaScript Scheduler) | DayPilot Pro for JavaScript Demo
- Tree
- DayPilot JavaScript Demo
- Catalog root
- Default
- Description
- You can specify sub-resources for a row, and split it into multiple rows vertically. Read more
about split resources.
Inline demo script 1
const dp = new DayPilot.Scheduler("dp", {
startDate: "2026-01-01",
days: 365,
scale: "Day",
timeHeaders: [
{groupBy: "Month", format: "MMMM yyyy"},
{groupBy: "Day", format: "d"}
],
treeEnabled: true,
rowHeaderColumns: [
{name: "Location", display: "name"},
{name: "Section", display: "name", split: true},
{name: "Capacity", display: "capacity", split: true},
],
onTimeRangeSelected: async (args) => {
const {result: name} = await DayPilot.Modal.prompt("New event name:", "New Event");
dp.clearSelection();
if (!name) return;
const e = new DayPilot.Event({
start: args.start,
end: args.end,
id: DayPilot.guid(),
resource: args.resource,
text: name,
barColor: "#6aa84f"
});
dp.events.add(e);
dp.message("Created");
},
height: 350,
treePreventParentUsage: true,
});
dp.init();
const app = {
loadData: async () => {
const resources = [
{
name: "Country 1", id: "C1", expanded: true, bubbleHtml: "test C1", children: [
{
name: "Location 1", id: "L1", bubbleHtml: "test L1", split: [
{name: "Section A", id: "L1.A", bubbleHtml: "test A", capacity: 40},
{name: "Section B", id: "L1.B", capacity: 40},
{name: "Section C", id: "L1.C", capacity: 30},
]
},
{
name: "Location 2", id: "L2", split: [
{name: "Section A", id: "L2.A", capacity: 10},
{name: "Section B", id: "L2.B", capacity: 10},
{name: "Section C", id: "L2.C", capacity: 15},
]
},
{
name: "Location 3", id: "L3", split: [
{name: "Section A", id: "L3.A", capacity: 10},
{name: "Section B", id: "L3.B", capacity: 20},
{name: "Section C", id: "L3.C", capacity: 30},
]
},
]
},
{
name: "Country 2", id: "C2", expanded: true, children: [
{
name: "Location 4", id: "L4", split: [
{name: "Section A", id: "L4.A", capacity: 40},
{name: "Section B", id: "L4.B", capacity: 40},
{name: "Section C", id: "L4.C", capacity: 30},
]
},
{
name: "Location 5", id: "L5", split: [
{name: "Section A", id: "L5.A", capacity: 10},
{name: "Section B", id: "L5.B", capacity: 10},
{name: "Section C", id: "L5.C", capacity: 15},
]
},
{
name: "Location 6", id: "L6", split: [
{name: "Section A", id: "L6.A", capacity: 10},
{name: "Section B", id: "L6.B", capacity: 20},
{name: "Section C", id: "L6.C", capacity: 30},
]
},
]
},
];
const events = [
{
id: 1,
text: "Event 1",
start: "2026-01-02T00:00:00",
end: "2026-01-06T00:00:00",
resource: "L1.B",
barColor: "#cc3a3a"
},
];
dp.update({resources, events});
},
init() {
this.loadData();
}
};
app.init();