问题
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