Agent-readable demo data

Title
Column Hierarchy (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
You can arrange columns in a hierarchy and group them by days or resource groups. Read more about the calendar column header hierarchy [doc.daypilot.org].

Inline demo script 1

const dp = new DayPilot.Calendar("dp", {
            startDate: DayPilot.Date.today(),
            viewType: "Resources",
            headerLevels: "Auto",
            headerHeight: 50,
            showCurrentTime: false,
            headerLevelHeights: [40, 80],
            columns: [
                {
                    name: "Big Cars", children: [
                        {name: "Big Car #1", id: "big1"},
                        {name: "Big Car #2", id: "big2"},
                        {name: "Big Car #3", id: "big3"},
                        {name: "Big Car #4", id: "big4"},
                    ]
                },
                {
                    name: "Small Cars", children: [
                        {name: "Small Car #1", id: "small1"},
                        {name: "Small Car #2", id: "small2"},
                        {name: "Small Car #3", id: "small3"},
                    ]
                }
            ],
            onTimeRangeSelected: async args => {
                const modal = await DayPilot.Modal.prompt("New event name:", "Event");
                if (modal.canceled) return;
                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    resource: args.resource,
                    text: modal.result
                });
                dp.clearSelection();
                dp.message("Created");
            },
            headerHeightAutoFit: true,
        });

        dp.init();


        const app = {
            init() {
                this.loadEventData();
            },
            loadEventData() {
                const events = [
                    {
                        start: DayPilot.Date.today().addHours(11),
                        end: DayPilot.Date.today().addHours(14),
                        id: DayPilot.guid(),
                        resource: "small2",
                        text: "Event 1"
                    },
                    {
                        start: DayPilot.Date.today().addHours(15),
                        end: DayPilot.Date.today().addHours(17),
                        id: DayPilot.guid(),
                        resource: "big2",
                        text: "Event 2"
                    },
                ];
                dp.update({events});
            }
        };
        app.init();