4 Replies Latest reply on Nov 1, 2007 2:39 PM by dmitry.demyankov

    updating dynamically date in calendar



      updating the calendar dynamically seems not to work as expected. the displayed date always the one at creation time. a reRender refuses to change the displayed date programatically.

      see the sample code:

       <h:selectOneMenu styleClass="blabla" value="#{mybean.option}">
       <f:selectItems value="#{mybean.values}" />
       <a4j:support ajaxSingle="true" event="onchange" reRender="id_calendar" />
       <rich:calendar id="id_calendar" popup="true"
       disabled="#{mybean.option != 'hide'}" value="#{mybean.date}"
       <f:facet name="footer" rendered="false">
       <verbatim />

      the point is that althoung mybean.getDate() returns an updated date value, it gets never picked up by the calendar component.


        • 1. Re: updating dynamically date in calendar

          I had an issue where, my calendar was not updating my back bean, even though inside an output panel, I had to use ajax support as show below, perhaps you need to do the same thing.

          <rich:calendar id="startDate" inputStyle="width:100px;" datePattern="dd/MM/yyyy" inputType="text" enableManualInput="true" value="#{startDate}" popup="true">
           <a:support event="ondateselected" action="submit()" />

          • 2. Re: updating dynamically date in calendar

            The following code snippet worked fine..


             <a4j:commandButton id="add_day_btn" value="add day" action="#{testBean.TestMethod}" reRender="panel, calendar"/>
            <h:panelGrid id="panel">
             <h:outputText value="#{testBean.date}"/>
            <rich:calendar id="calendar" value="#{testBean.date}" popup="true" datePattern="dd.MM.yyyy"/>

            TestBean contains date property with simple get/set methods. Inside TestMethod of TestBean one day is added to the current value of date. Very simple..

            Both panel and rich:calendar are reRendered and correct value of date property is displayed.

            What is the scope of your bean? What exactly are you trying to archive - is it changing currently displayed date in calendar or submitting new date selected in calendar?

            • 3. Re: updating dynamically date in calendar

              yes, im trying smth simple, similar to what you described. a backing bean changes some date thru a widget, an forces thru a reRender the calendar widget to redisplay that date - and that is not happening :-( . the backing bean returns the updated date though, as i can tell from my output log. everything else works just fine. it looked to me as if the calendar refused for ssome reason to update programatically that date.

              im using release 3.1.3. snapshot from about two weeks ago.

              • 4. Re: updating dynamically date in calendar

                My code example worked with 3.1.2GA version. Maybe I'll try it with 3.1.3