Skip to content

viewOptions

Options a family of views takes beyond the calendar’s own, keyed by family.

TypeReadonly<Record<string, unknown>>
Defaultnot set
Live update (update())Yes
Declared inpackages/dom/src/calendar.ts

A family that is not built in — the Pro’s timeline, a view of your own made with defineView — reads its settings from here, under its family’s name. Today the Pro’s timeline reads viewOptions.timeline.areaColumns: the resource area’s columns, each { field, header?, width? } (field read from the resource, then what you gave, then extendedProps; width in pixels, 160 for the first and 110 for the others by default).

update({ viewOptions }) redraws a family whose object is replaced — compared by reference, family by family: keep the object stable. The title column’s head is messages.resource’s words unless header says otherwise.

import { createCalendar } from '@dzcalendar/dom';
import '@dzcalendar/pro';
createCalendar(element, {
timeZone: 'Europe/Paris',
initialView: 'resourceTimelineDay',
resources: [{ id: 'benali', title: 'Dr Benali', room: 'A12' }, { id: 'haddad', title: 'Dr Haddad', room: 'B03' }],
viewOptions: { timeline: { areaColumns: [{ field: 'title', header: 'Doctor', width: 170 }, { field: 'room', header: 'Room' }] } },
});

In Angular and Vue it goes in options; in React it is a prop.

The timeline’s resource area shows each resource’s title and room.