# Days-Resources View (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo

> You can arrange columns in a hierarchy and group them by days or resource groups. Read more about the calendar [column header hierarchy](https://doc.daypilot.org/calendar/column-header-hierarchy/) [doc.daypilot.org].

## Links

- Canonical HTML: /demo/calendar/daysresources.html
- Source HTML folder: /demo/calendar/
- Catalog root: /demo/
- Catalog: /demo/llms.txt

## Source

### Inline demo script 1

```javascript
const dp = new DayPilot.Calendar("dp", {
            viewType: "Resources",
            headerLevels: "Auto",
            headerHeight: 50,
            showCurrentTime: false,
            columns:  [
                {
                    name: DayPilot.Date.today().toString("MMMM d, yyyy"), children: [
                        {name: "Machine #1", id: "m1", start: DayPilot.Date.today()},
                        {name: "Machine #2", id: "m2", start: DayPilot.Date.today()},
                        {name: "Machine #3", id: "m3", start: DayPilot.Date.today()}
                    ]
                },
                {
                    name: DayPilot.Date.today().addDays(1).toString("MMMM d, yyyy") , children: [
                        {name: "Machine #1", id: "m1", start: DayPilot.Date.today().addDays(1)},
                        {name: "Machine #2", id: "m2", start: DayPilot.Date.today().addDays(1)},
                        {name: "Machine #3", id: "m3", start: DayPilot.Date.today().addDays(1)}
                    ]
                }
            ],
            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().firstDayOfWeek().addDays(1).addHours(11),
                        end: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(14),
                        id: DayPilot.guid(),
                        resource: "m1",
                        text: "Event 1"
                    },
                    {
                        start: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(15),
                        end: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(17),
                        id: DayPilot.guid(),
                        resource: "m2",
                        text: "Event 2"
                    },
                ];
                dp.update({events});
            }
        };
        app.init();
```

