Skip to content

resourceOrder

How resources are ordered among their siblings, after their own order.

TypeResourceOrder | undefined
Defaultnot set
Live update (update())Yes
Declared inpackages/core/src/kernel.ts

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) => number over 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).

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' });

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

The columns by title, Z to A.