resourceGroupField
A field of the resources: resource views put a head over each run of resources sharing its value.
| Type | string | undefined |
|---|---|
| Default | not set |
Live update (update()) | Yes |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”With resourceGroupField: 'service', the columns of a resource view (the
rows of a timeline) gather under a head per service, in the order the groups
first come. The field is read from the resource, then its extendedProps.
Grouping applies to the roots of the tree; each root’s children stay in its
group. In the Pro’s timeline a group can be shut (collapsedGroups). The
head’s look is the application’s through hooks.resourceGroupHeader.
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';
createCalendar(element, { timeZone: 'Europe/Paris', initialView: 'resourceTimeGridDay', resources: [ { id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }, ], resourceGroupField: 'service',});import { Component } from '@angular/core';import { DZ_CALENDAR } from '@dzcalendar/angular';
@Component({ selector: 'app-agenda', imports: [DZ_CALENDAR], template: `<dz-calendar timeZone="Europe/Paris" view="resourceTimeGridDay" [resources]="staff" [options]="{ resourceGroupField: 'service' }" />`,})export class Agenda { readonly staff = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];}import { DzCalendar } from '@dzcalendar/react';
const STAFF = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" defaultView="resourceTimeGridDay" resources={STAFF} resourceGroupField="service" />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';
const staff = [{ id: 'benali', title: 'Dr Benali', service: 'Cardiology' }, { id: 'room1', title: 'Room 1', service: 'Imaging' }];</script>
<template> <DzCalendar time-zone="Europe/Paris" view="resourceTimeGridDay" :resources="staff" :options="{ resourceGroupField: 'service' }" /></template>In Angular and Vue it goes in options; in React it is a prop.
Live demo
Section titled “Live demo”The columns under a head per service.
See also
Section titled “See also”resources— the field is theirs.resourceOrder— the order inside a group.collapsedGroups— a timeline’s shut groups.