Highlight current week in RichFaces calendar

我怕爱的太早我们不能终老 提交于 2019-12-08 12:39:20

问题


Is there a way to highlight the current or selected week in a RichFaces calendar?

<rich:calendar value="#{oc.overtimeDate}" requiredMessage="Date 1 is required."
  id="#{oc.overtimeDateId}" isDayEnabled="isDayEnabled"
  dayStyleClass="getDisabledStyle" datePattern="MM-dd-yyyy"
  required="true" firstWeekDay="0"/>

回答1:


<rich:calendar> has @dayClassFunction (see the docs)

It can look like this:

<h:outputStylesheet>
    .highlightWeek {
        color: red;
        background-color: black;
    }
</h:outputStylesheet>
<h:outputScript>
    var currentWeekNumber = … // determine current week number
    chooseDay = function(day) {
        if (day.weekNumber == currentWeekNumber) return 'highlight';
            return '';
        }
</h:outputScript>
<h:form>
    <rich:calendar dayClassFunction="chooseDay" />
</h:form>


来源:https://stackoverflow.com/questions/21152356/highlight-current-week-in-richfaces-calendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!