开发者

How can a particular day be disabled in richfaces calendar?

开发者 https://www.devze.com 2023-01-20 02:49 出处:网络
How can be disabled particular day in richfaces calendar? Like if i want to disable all the friday and satur开发者_高级运维day of that month, so wahat i have to do? I got an answer from richfaces sho

How can be disabled particular day in richfaces calendar?

Like if i want to disable all the friday and satur开发者_高级运维day of that month, so wahat i have to do?


I got an answer from richfaces showcase gallery,

there is property "isDayEnabled" over there we can set script function and then we can make it disabled.

<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>
0

精彩评论

暂无评论...
验证码 换一张
取 消