collapsedGroups
The groups (by their resourceGroupField value) a timeline shows shut.
| Type | readonly string[] |
|---|---|
| Default | [] |
Live update (update()) | Yes |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”With resourceGroupField, the Pro’s timeline (import '@dzcalendar/pro')
draws a row per group above its resources, with a button that shuts and
opens it. collapsedGroups names the shut ones by the field’s value
('Imaging'); like collapsedResources, it is the calendar’s state, kept
across update() and reported by onResourceToggle.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';import '@dzcalendar/pro';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', initialView: 'resourceTimelineDay', resources: [ { id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }, ], resourceGroupField: 'service', collapsedGroups: ['Imaging'],});
// Later: every group open.calendar.update({ collapsedGroups: [] });import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';import '@dzcalendar/pro';
@Component({ selector: 'app-planning', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" view="resourceTimelineDay" [resources]="staff" [options]="{ resourceGroupField: 'service', collapsedGroups: ['Imaging'] }" />`,})export class Planning { readonly staff = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];}import { DzCalendar } from '@dzcalendar/react';import '@dzcalendar/pro';
const STAFF = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];
export function Planning() { return <DzCalendar timeZone="Europe/Paris" defaultView="resourceTimelineDay" resources={STAFF} resourceGroupField="service" collapsedGroups={['Imaging']} />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';import '@dzcalendar/pro';
const staff = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];</script>
<template> <DzCalendar time-zone="Europe/Paris" view="resourceTimelineDay" :resources="staff" :options="{ resourceGroupField: 'service', collapsedGroups: ['Imaging'] }" /></template>In Angular and Vue it goes in options; in React it is a prop.
Live demo
Section titled “Live demo”The Imaging group shut, Cardiology open.
See also
Section titled “See also”resourceGroupField— what makes the groups.collapsedResources— the same for resources.onResourceToggle— what the person shut.