【问题标题】:Changing Schedule's Event CSS from back bean [duplicate]从后台bean更改计划的事件CSS [重复]
【发布时间】:2019-07-09 12:06:34
【问题描述】:

我需要根据一些规则更改事件背景颜色,我已经尝试了setStyleClass(),但没有成功(我已经在页面中使用了<h:OutputStylesheet><link> 和内联 CSS)

我的 CSS(也尝试了 .fc-event-skin e 在网络中搜索的所有变体)

.atendido .fc-event { 
   background-color: green !important;
   border-color: green !important;
   color: white !important;
}

部分后台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。

【问题讨论】:

  • 对不起,我更新了时间表代码。是的,我可以在源代码中看到“atendido”,但在事件本身中看不到,只是在源代码中
  • 你可以试试 CSS 规则 .atendido.fc-event(所以类之间没有空格)?
  • @JasperdeVries 已经尝试过了,不起作用
  • 您需要创建一个比body .fc .fc-event 更具体的规则。见stackoverflow.com/questions/8768317/…

标签: primefaces schedule


【解决方案1】:

在 Primefaces 7.0 中,您可以使用 .fc-bg

使用以下 CSS 代码:

.atendido .fc-bg {
    background-color: red;
    border-color: red;
    color: white;
    opacity: 1;
}

在后面的bean中,我刚刚调用了event.setStyleClass("atendido");

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-23
    • 2012-07-22
    • 2021-12-05
    • 2018-12-11
    • 1970-01-01
    相关资源
    最近更新 更多