6 Replies Latest reply: Feb 15, 2011 7:13 AM by Vishwanath Bannur RSS

rich:calendar, problem reRendering panel

Ioana Iacob Newbie

Hi,

 

    I have a rich:calendar which I'm using as an organizer. Some dates are enbled, as they have related data and others are not. The first time the calendar is rendered, the value is set to tha first available date and related data is shown. So for instance 16/03/2010 selected and 20/03/2010 and 25/03/2010 enabled. the first time I click on a nother date, nothing happens, and the next times, the data displayed is one step behind. So for instance if I click 20/03 nothing happens, if I click 25/03, I get the data related to 20/03. I get no errors in the a4j:log. It's driving me crazy!!!

Code snippet:

<a4j:form id="wsForm">
   <a4j:region selfRendered="true">
         <h:panelGrid columns="3" cellpadding="2" cellspacing="0" styleClass="calendar" id="calendarPanel" forceId="true">
               <!-- Calendar -->
            <rich:calendar value="#{worksheetBean.selectedDate}" 
                     dataModel="#{calendarDataModel}" 
                      popup="false" showApplyButton="false" 
                      cellWidth="50px" cellHeight="50px" 
                      boundaryDatesMode="none" showWeeksBar="false" 
                      id="organizer" 
                      showFooter="false">
                 <f:facet name="header">
                   <h:panelGroup>                               
                         <h:outputText value="#{worksheetBean.selectedDate}">
                               <f:convertDateTime pattern="MMMM, yyyy" locale="#{UIConfigurationsBean.locale}" 
                                 timeZone="#{UIConfigurationsBean.timeZone}" />
                         </h:outputText>
                    </h:panelGroup>
                 </f:facet>
                <a4j:outputPanel layout="block" styleClass="cell" title="{toolTip}">
                         <h:outputText value="{day}"   />
                 </a4j:outputPanel>
                 <a4j:support event="ondateselected"  reRender="wsForm:hoursPanel" />                           
             </rich:calendar>
                <!-- Time slots -->
          <a4j:outputPanel id="hoursPanel">
               <rich:dataGrid value="#{worksheetBean.paints}" var="paint" columns="8">
                      <h:panelGroup>
                           <rich:paint2D width="65" height="60"  data="#{paint}" format="gif" 
                                 paint="#{worksheetBean.paint}" title="#{paint.text}">                                     
                           </rich:paint2D>
                          <h:outputText value="#{paint.text}" />
                 </h:panelGroup>                    
                 </rich:dataGrid>
          </a4j:outputPanel>                                                
      </h:panelGrid> 
   </a4j:region>  
</a4j:form>     

Richfaces version : 3.3.2.SR1.

  • 1. Re: rich:calendar, problem reRendering panel
    Ioana Iacob Newbie

    Fixed problem by using

     

    <a4j:support event="onchanged"  reRender="wsForm:hoursPanel" />

     

    instead of

     

    <a4j:support event="ondateselected"  reRender="wsForm:hoursPanel" />          
  • 2. Re: rich:calendar, problem reRendering panel
    Ilya Shaikovsky Master
    It's better to use onchanged i'm still not sure where original problem is but onchanged fired after date selected and input updated. So should be filled with the proper date
  • 3. Re: rich:calendar, problem reRendering panel
    Ioana Iacob Newbie

    Right.. Thanks.

    I have a doubt though .. Currently, the scope of my CalendarDataModelImpl bean is request. Which is best practice? Session or Request?

    Sometimes (but hard to reproduce) I'm getting some refresh problems.

  • 4. Re: rich:calendar, problem reRendering panel
    Ioana Iacob Newbie

    If using a rich:combo to trigger month change, once a day is selected, the datamodel does not refresh anymore on changing month, unless using both

     

    value="#{Bean.selectedDate}"  currentDate="#{Bean.selectedDate}"

     

    In case anyone has the same problem..

  • 5. Re: rich:calendar, problem reRendering panel
    Markos Fragkakis Newbie

    Is there a Jira issue for this?

  • 6. rich:calendar, problem reRendering panel
    Vishwanath Bannur Newbie

    Hi,

    Same problem here. Can anybody help me?

    I have page as below. I select the date in date component and click on search. In backing bean i construct selected date "CalendarDataModelItem[] items". However the 'organizer' calender component is not rendered. It is still showing old date. When i refresh the browser, that time its showing the selected date in 'organizer' component. Can you please help me how to refresh the 'organizer' coponent when i do the search operation.

     

    <h:form id="form">

            <rich:messages/>

            Enter Date: <rich:calendar value="#{calendarBean.inputDate}" />

            <a4j:commandButton value="Search" actionListener="#{calendarBean.searchCalendar}" reRender="organizer" />

           

            <a4j:region>

            <rich:calendar value="#{calendarBean.selectedDate}" mode="ajax"

                popup="false" showApplyButton="false"

                cellWidth="80px" cellHeight="80px"

                boundaryDatesMode="none" showWeeksBar="false"

                dataModel="#{calendarDataModel}" onchanged="if (event.rich.date) {ajaxSubmit();}"

                oncurrentdateselect="return true" id="organizer" valueChangeListener="#{calendarDataModel.valueChanged}" showFooter="true">

                <f:facet name="header">

                    <h:panelGroup>

                        <h:outputText value="Selected Month" styleClass="header"/>

                    </h:panelGroup>

                </f:facet>

                <a4j:outputPanel  ajaxRendered="true" layout="block" id="cell" onclick="#{rich:component('organizer')}.resetSelectedDate()" style="height: 100%;" styleClass="organizer-cell">

                    <div>

                        <h:outputText value="{day}" style="align:center" />

                    </div>

                    <div>&#xA0;</div>

                    <div>

                        <h:outputText value="{data.shortDescription.escapeHTML()}" />

                    </div>

                    <div>

                        <h:outputText value="{data.description.escapeHTML()}"/>

                    </div>

                </a4j:outputPanel>

               

                 <f:facet name="footer"> 

                   

                     <h:panelGrid columns="7" width="100%">

                              <h:outputText value="{previousYearControl}" style="font-weight:bold;"/>

                            <h:outputText value="{previousMonthControl}" style="font-weight:bold;"/><!--

                            <h:outputText value="{todayControl}" style="font-weight:bold;"/>

                            <h:outputText value="{selectedDateControl}" style="font-weight:bold;"/>       

                            --><h:outputText value="{currentMonthControl}" style="font-weight:bold;"/>       

                            <h:outputText value="{nextMonthControl}" style="font-weight:bold;"/>

                            <h:outputText value="{nextYearControl}" style="font-weight:bold;"/>

                            </h:panelGrid>

                     </f:facet>                 

            </rich:calendar>

           

            </a4j:region>

        </h:form>