The background color for the events is set based on the colorField. If we want to set the separate color for each event, we should remove the colorField and include the custom field in the event object to maintain the color.
{
Id: 10,
Name: "David",
StartTime: new Date(2018, 7, 1, 9, 0),
EndTime: new Date(2018, 7, 1, 10, 0),
Description: "Health Checkup",
DepartmentID: 1,
ConsultantID: 1,
DepartmentName: "GENERAL",
CategoryColor: "Blue"
}
and, apply this color field for the event while it's rendering by making use of eventRendered event like the below.
oneventRendered(args: EventRenderedArgs): void {
let categoryColor: string = args.data.CategoryColor as string;
if (!args.element || !categoryColor) {
return;
}
if (this.scheduleObj.currentView === 'Agenda') {
(args.element.firstChild as HTMLElement).style.borderLeftColor = categoryColor;
} else {
args.element.style.backgroundColor = categoryColor;
}
}
For more reference, please refer the below demo link and get back to us for further assistance.
Sample: https://stackblitz.com/edit/angular-udwvvf-fbm7mw?file=app.component.ts
UG Link: https://ej2.syncfusion.com/angular/documentation/schedule/appointments/?no-cache=1#using-eventrendered-event