2 Replies Latest reply on Apr 16, 2009 9:12 AM by Pinar Cayirli

    rich calendar rerender problem

    Pinar Cayirli Newbie

      Hi,
      I have two dates (begin,end) and two calendar. As initial, end date 1 month later than begin date. I want to change months simultaneously.
      when page is first load rerender is work after that not work.
      My code is;

      <rich:calendar id="calendar" popup="false" value=#{bean.beginDate}"
       currentDateChangeListener= #{bean.prevChangeMonth}">
       <a4j:support ajaxSingle="true" event="oncurrentdateselected" reRender="calendar2,calendar" />
      <f:facet name="header">
       <h:panelGrid columns="2" width="100%">
       <h:outputText value="{previousMonthControl}" style="font-weight:bold"/>
       <h:outputText value="{currentMonthControl}" style="font-weight:bold; text-align:center"/>
       </h:panelGrid>
      </f:facet>
      </rich:calendar>
      <rich:calendar id="calendar2" popup="false" value="#{bean.endDate}"
       currentDateChangeListener="#{bean.nextChangeMonth}">
       <a4j:support ajaxSingle="true" event="oncurrentdateselected" reRender="calendar,calendar2" />
      <f:facet name="header">
       <h:panelGrid columns="2" width="100%">
       <h:outputText value="{currentMonthControl}" style="font-weight:bold"/>
       <h:outputText value="{nextMonthControl}" style="font-weight:bold; text-align:center"/>
       </h:panelGrid>
      </f:facet>
      </rich:calendar>
      

      public void prevChangeMonth(CurrentDateChangeEvent event){
       Calendar c = Calendar.getInstance();
       initDate = event.getCurrentDate();
       c.setTime(initDate);
       beginDate = c.getTime();
       c.add(Calendar.MONTH, 1);
       endDate = c.getTime();
       System.out.println("BEGIN...BeginDate...: "+beginDate+" "+"EndDate....: "+endDate);
       }
      
       public void nextChangeMonth(CurrentDateChangeEvent event){
       Calendar c = Calendar.getInstance();
       initDate = event.getCurrentDate();
       c.setTime(initDate);
       endDate = c.getTime();
       c.add(Calendar.MONTH, -1);
       beginDate = c.getTime();
       System.out.println("END...BeginDate...: "+beginDate+" "+"EndDate....: "+endDate);
       }
      


      Thanks