How to use SchedulerData to configure the scheduler
masterThe SchedulerData class is used to manage the state of the scheduler, including the current date, view type, resources, events, and locales.
Key methods include:
setResources(resources: Array): Defines the resources (e.g., people, rooms) available in the scheduler. Resources can have aparentIdto create hierarchies orgroupOnly: trueto act as a group.setEvents(events: Array): Sets the list of scheduled events. Important: The event array must be sorted in ascending order by theevent.startproperty to avoid rendering errors.setSchedulerLocale(locale: string): Sets thedayjslocale for the scheduler.setCalendarPopoverLocale(locale: string): Sets the Ant Design locale for the calendar popover.
Events can include properties like resizable, movable, and startResizable (set to false to disable these interactions) and rrule for recurring tasks.
const schedulerData = new SchedulerData(new dayjs().format(DATE_FORMAT), ViewType.Week);
schedulerData.setResources([
{ id: 'r0', name: 'Resource0', groupOnly: true },
{ id: 'r1', name: 'Resource1' },
{ id: 'r2', name: 'Resource2', parentId: 'r0' },
]);
schedulerData.setEvents([
{
id: 1,
start: '2022-12-18 09:30:00',
end: '2022-12-19 23:30:00',
resourceId: 'r1',
title: 'I am finished',
bgColor: '#D9D9D9',
},
]);