resourceOrder
How resources are ordered among their siblings, after their own order.
| Type | ResourceOrder | undefined |
|---|---|
| Default | not set |
Live update (update()) | Yes |
| Declared in | packages/core/src/kernel.ts |
What it does
Section titled “What it does”Resources go depth first, children right under their parent. Among
siblings: their order first (lowest first), then resourceOrder, then as
given.
- A field name:
'title';'-title'for descending. - Several, by priority:
'service,title'or['service', '-title']. - A comparison
(a, b) => numberover the resources.
Fields are read from the resource’s own (title, order), then from what
you gave, then from its extendedProps. Numbers compare as numbers, text by
code unit (the same order on every machine), an absent value last in either
direction. A comparison function receives the resources as the calendar
keeps them: your own fields are under .input (or .extendedProps). One
that throws puts the whole tree back in the order given, said through
onResourceProblems (invalid-resource at resourceOrder).
Example
Section titled “Example”import { createCalendar } from '@dzcalendar/dom';
const calendar = createCalendar(element, { timeZone: 'Europe/Paris', initialView: 'resourceTimeGridDay', resources: [{ id: 'a', title: 'Room 2', floor: 1 }, { id: 'b', title: 'Room 1', floor: 2 }], resourceOrder: 'floor,title',});
// Later: by title, descending.calendar.update({ resourceOrder: '-title' });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]="rooms" [options]="{ resourceOrder: '-title' }" />`,})export class Agenda { readonly rooms = [{ id: 'a', title: 'Room 2' }, { id: 'b', title: 'Room 1' }];}import { DzCalendar } from '@dzcalendar/react';
const ROOMS = [{ id: 'a', title: 'Room 2' }, { id: 'b', title: 'Room 1' }];
export function Agenda() { return <DzCalendar timeZone="Europe/Paris" defaultView="resourceTimeGridDay" resources={ROOMS} resourceOrder="-title" />;}<script setup lang="ts">import { DzCalendar } from '@dzcalendar/vue';
const rooms = [{ id: 'a', title: 'Room 2' }, { id: 'b', title: 'Room 1' }];</script>
<template> <DzCalendar time-zone="Europe/Paris" view="resourceTimeGridDay" :resources="rooms" :options="{ resourceOrder: '-title' }" /></template>In Angular and Vue it goes in options; in React it is a prop.
Live demo
Section titled “Live demo”The columns by title, Z to A.
See also
Section titled “See also”resources— theirordercomes first.resourceGroupField— groups, then order inside them.- Resources & timeline.