Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

498
Visualizações
Angular10 Syncfusion how to give dynamic colors to appointment events

I am working on angular application where I am using syncfusion scheduler to show appointments on calendar. I want to give dynamic color or class to events so that I can do some styling. I am not sure how to do it. The only way I am able to do is by adding category color on events

enter image description here

I want to achieve to style the events on calendar like image but not with just one color. I want to use different colors. Below is my code

 <ejs-schedule #scheduleObj class="schedule" cssClass='schedule-group-custom-work-days' width='100%' height='650px'
  [selectedDate]="selectedDate" [eventSettings]='eventSettings' [showQuickInfo]='showQuickInfo'
  (cellDoubleClick)='cellDoubleClick($event)' (popupOpen)='onPopupOpen($event)'
  (actionComplete)="onActionComplete($event)" (eventRendered)="onEventRendered($event)" 
  (renderCell)="onRenderCell($event)" [workDays]='workWeekDays'>
</ejs-schedule>

component.ts

@ViewChild('scheduleObj')
  public scheduleObj!: ScheduleComponent;
  public eventSettings: EventSettingsModel = { dataSource: [] };
  public selectedDate: Date = new Date();
  public workWeekDays!: number[];
  events: any[] = [];

getAppointment(){
//api call and got response

const events: any[] = [];

events.push({
            Id: appointment.id.toString(),
            Subject:
            appointment.patientFirstName + ' ' + appointment.patientLastName,
            // BELOW IS THE VARIABLE WHICH I AM USING FOR ADDING BACKGROUND COLOR AS RED
            CategoryColor: "red"
            StartTime: startDate,
            EndTime: endDate
          });
this.events = events;

this.eventSettings = {
     dataSource: <Object[]>extend([], events, null, true)
};

Is there a way I can add class to my events or some way to style my events with different different colors.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use the different color or class to the events by making use of the cssClass field in the appointment model. For more references, please visit to the below page.

https://ej2.syncfusion.com/angular/documentation/schedule/appointments/#using-cssclass

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda