search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Multicolumn in week Calendar

Asked by Andrea R.
2 years ago.

Hi,
I use Daypilot Pro Calendar to create an agenda for a group of people.
How can I create more columns (one for each person) for each day of the calendar in "week mode"?
My best, Thank you

Answer posted by Dan Letecky [DayPilot]
2 years ago.

When you switch the calendar viewType to "Resources", you can define custom columns.

Take a look at the following documentation page:
https://doc.daypilot.org/calendar/column-header-hierarchy/

Example:
dp.columns = [];

const resources = [
    {name: "Resource A", id: "A"},
    {name: "Resource B", id: "B"},
    {name: "Resource C", id: "C"},
];

const start = DayPilot.Date.today().firstDayOfWeek();
for (var i = 0; i < 7; i++) {
    const date = start.addDays(i);
    const column = {name: date.toString("MMMM d, yyyy")};

    column.children = resources.map(r => ({
        name: r.name,
        id: r.id,
        start: date
    }));

    dp.columns.push(column);
};
Comment posted by Andrea R.
2 years ago.

thank you!

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.