我需要根据某些规则更改事件背景颜色,并且我已经尝试了setStyleClass()
并没有成功(我已经在页面中使用过<h:OutputStylesheet>
,<link>
和内联CSS)
我的CSS(也尝试使用.fc-event-skin e在网络中搜索所有变体形式)
.atendido .fc-event {
background-color: green !important;
border-color: green !important;
color: white !important;
}
部分back bean代码:
Paciente p = pDAO.getById(9999998, Paciente.class);
IdAgenda idAgend = new IdAgenda(dataHoje, p, ambulatorioDoUsuario);
Agenda a = new Agenda(idAgend, diaDeHoje, 1, null, null, false, null, true, false, false, null, false);
apagarSemMensagem();
success = aDAO.save(a);
if (success == true) {
novoAgendamento.setTitle(p.getNome());
novoAgendamento.setStyleClass("atendido");
eventModel.addEvent(novoAgendamento);
}
时间表:
<p:schedule id="agendaOcupacional" allDaySlot="false" slotLabelFormat="HH:mm" widgetVar="myAgendaOcupacional"
draggable="false" resizable="false" timeZone="GMT-3" extender="initSchedule" class="bg" slotEventOverlap="false"
showWeekends="false" view="agendaDay" slotDuration="00:15:00" value="#{agendamentoBean.eventModel}" locale="br" >
<p:ajax event="dateSelect" listener="#{agendamentoBean.onDateSelect}" oncomplete="PF('myAgendaOcupacional').update()"/>
<p:ajax event="eventSelect" listener="#{agendamentoBean.onEventSelect}" />
</p:schedule>
我正在使用Primefaces 7.0。
编辑:在Primefaces 5.0中,使用了fc-event-inner。
答案 0 :(得分:0)
在Primefaces 7.0中,您可以使用.fc-bg
使用以下CSS代码:
.atendido .fc-bg {
background-color: red;
border-color: red;
color: white;
opacity: 1;
}
在back bean中,我刚刚打电话给event.setStyleClass("atendido");