1 Reply Latest reply on Jun 22, 2012 3:05 PM by Diogo Castro

    Fire action when change month in calendar.

    speedygonzales Newbie

      I am using rich calendar with my own CalendarDataModel object. I have three type of events. Each cell in current month  displays an icon if we have that type of event for the day, and it is set in CalendarDataModelItem . But it doesn't work for the previous month/next month . Although when I select a date it is display correctly. Somehow I have to fire the action that checks what kind of the events there are in the current month when I change the month. Any help will be appreciated.

      {code:xml}<rich:calendar

                          value="#{calendarData.currentDate.time}" popup="false"

                          showApplyButton="false" cellWidth="53px" cellHeight="45px"

                          boundaryDatesMode="scroll" showWeeksBar="false"

                          style="font-style:italic;" dataModel="#{calendarData}"

                          id="organizer" showFooter="false" showHeader="true" mode="ajax">

                          <!--  -->

                          <f:facet name="header">

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

                                  <h:outputText value="{previousMonthControl}"

                                      style="text-align:left">

                                      <a4j:support action="#{calendarData.actionCreateTable}"

                                          ajaxSingle="true" event="onclick"  oncomplete="document.forms[0].submit();"/>

                                  </h:outputText>

                                  <h:outputText value="{currentMonthControl}"

                                      style="text-align:center" />

                                  <h:outputText value="{nextMonthControl}" style="text-align:right">

                                      <a4j:support action="#{calendarData.actionCreateTable}"

                                          ajaxSingle="true" event="onsubmit" />

                                  </h:outputText>

                              </h:panelGrid>

                          </f:facet>

                          <a4j:outputPanel layout="block" id="cell">

                              <div>

                                  <h:outputText value="{day}" style="align:center; font-size:14px;" />

                              </div>

                              <div>&#xA0;</div>

                              <div>

                                  <h:outputText value="{hasKom}" escape="false" />

                                  <rich:spacer width="1" />

                                  <h:outputText value="{hasProg}" escape="false" />

                                  <rich:spacer width="1" />

                                  <h:outputText value="{hasNews}" escape="false" />           

                              </div>

                          </a4j:outputPanel>

                          <a4j:support event="onchanged"

                              oncomplete="document.forms[0].submit();"

                              action="#{calendarData.actionCreateTable}" ajaxSingle="true"

                              reRender="Calendarform_" />

                          <a4j:support event="onsubmit"

                              reRender="organizer,news,meeting,prime,rest,dataTable_news,dataTable_news_all,dataTable_prog_all,dataTable_kom_all,dataTable_kom,dataTable_prog" />

                      </rich:calendar>{code}

        • 1. Re: Fire action when change month in calendar.
          Diogo Castro Newbie

          Hi, I've took the same mistake once, and I've thought it was interesting to post here, to help people..

           

           

          The richfaces calendar has an attribute called "onbeforedomupdate" that invokes the event listener after the Ajax response has been returned but before the DOM tree of the browser has been updated.

           

           

          He trows an event when the calendar DOM is updated, i.e. when the month, year, is changed