如何在richfaces日历中禁用特定日期?
如果我想在那个月的周六和周六停用,那么我必须做什么?
答案 0 :(得分:1)
我从richfaces showcase gallery得到了答案,
那里有属性“isDayEnabled”我们可以设置脚本功能然后我们可以禁用它。
<script>
var curDt = new Date();
function disablementFunction(day)
{
if (day.date.getDay()==5 || day.date.getDay()==6 || day.date.getDate()==26)
return false;
return true;
}
function disabledClassesProv(day)
{
var res = '';
if (day.date.getDay()==5 || day.date.getDay()==6 || day.date.getDate()==26)
res+='weekendBold ';
if (day.date.getDay()==5 || day.date.getDay()==6 || day.date.getDate()==26)
res+='everyThirdDay';
return res;
}
</script>
<tr>
<td>
<h:panelGrid id="panel" columns="2" columnClasses="ecol1, ecol2">
<a4j:outputPanel id="calendar" layout="block">
<rich:calendar value="#{UserRegister.sDate}"
popup="true"
datePattern="dd/M/yy hh:mm a"
showApplyButton="false" dayStyleClass="disabledClassesProv" isDayEnabled="disablementFunction" cellWidth="24px" cellHeight="22px" style="width:200px"/>
</a4j:outputPanel>
<h:panelGrid columns="2">
</h:panelGrid>
</h:panelGrid>
</td>
</tr>