tags:

views:

11

answers:

1

How can be disabled particular day in richfaces calendar?

Like if i want to disable all the friday and saturday of that month, so wahat i have to do?

A: 

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.

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; }
            <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>
Sanju