Как можно отключить определенный день в календаре richfaces? - PullRequest
0 голосов
/ 12 октября 2010

Как отключить определенный день в календаре richfaces?

Например, если я хочу отключить все пятницу и субботу этого месяца, так что мне делать?

1 Ответ

1 голос
/ 13 октября 2010

Я получил ответ из демонстрационной галереи richfaces,

там есть свойство "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>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...