Change the color of primefaces Scheduler Event

后端 未结 6 1577
温柔的废话
温柔的废话 2020-12-15 14:08

I am using primefaces(3.0) scheduler component.

http://www.primefaces.org/showcase-labs/ui/schedule.jsf

As we can see here there there are some events create

6条回答
  •  一整个雨季
    2020-12-15 14:33

    There's a constructor for DefaultScheduleEvent that takes a CSS class as parameter:

    eventModel = new DefaultScheduleModel();  
    eventModel.addEvent(new DefaultScheduleEvent("Event for employee 1", new Date(), laterToday(), "emp1"));
    eventModel.addEvent(new DefaultScheduleEvent("Event for employee 2", tomorrow(), laterTomorrow(), "emp2"));  
    

    emp1 and emp2 are the style classes.

    For PrimeFaces 3.0 add the following css to your style sheet:

    .emp1 .fc-event-skin {
        background: red;
    }
    .emp2 .fc-event-skin {
       background: green;
     }
    

    For other PrimeFaces versions, see the other answers

提交回复
热议问题