8 Replies Latest reply on Mar 2, 2009 7:12 AM by nbelaevski

    ModalPanel self rerender

    depy

      I have 2 modal panels. One is main panel with chart and some stuff and one panel is loading panel.

      What I want is when you click an actionLink inside the main panel the panel rerenders it self but until it is not complete the loading panel is showed.

      Here is my code that does not work:

      <rich:modalPanel id="panel" width="750" height="350">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Modal Panel"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:outputText value="[X]" styleClass="hidelink" id="hidelink"/>
       <rich:componentControl for="panel" attachTo="hidelink" operation="hide" event="onclick"/>
       </h:panelGroup>
       </f:facet>
       <h:panelGrid columns="2">
       <rich:dataTable width="75" id="avaliableDatesTable" value="#{chartBean.availableDates}" var="d">
       <rich:column>
       <a4j:commandLink reRender="panel" actionListener="#{chartBean.paramListener}" value="#{d.date}" timeout="30" onclick="Richfaces.hideModalPanel('panel');Richfaces.showModalPanel('loadingPanel')" oncomplete="Richfaces.hideModalPanel('loadingPanel');Richfaces.showModalPanel('panel')">
       <f:attribute name="chartDateFrom" value="#{d.dateFromInMSeconds}"/>
       <f:attribute name="chartDateTo" value="#{d.dateToInMSeconds}"/>
       </a4j:commandLink>
       </rich:column>
       </rich:dataTable>
      
       <chart:chart antialias="true" legend="false" type="timeseries" datasource="#{chartBean.dataSet}" height="300" id="chart1" title="#{chartBean.chartTitleDate}" width="600" xlabel="" ylabel=""/>
       </h:panelGrid>
       </rich:modalPanel>
      
       <rich:modalPanel id="loadingPanel" width="300" height="60">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Loading"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <rich:spacer height="5"/>
       <h:graphicImage value="resources/loading1.gif"/>
       <rich:spacer width="30"/>
       <h:outputText value="Loading chart data. This could take a while."/>
       </rich:modalPanel>
      


      The chartBean.paramListener does not invoke at all.

        • 1. Re: ModalPanel self rerender

          Please consider the following rule from the dev guide: "To work properly the <rich:modalPanel> should always be placed outside the original <h:form> and must include its own <h:form> for such cases like performing submissions from within the <rich:modalPanel>." (6.69.5)

          That means, you need a form in your first modal panel.

          • 2. Re: ModalPanel self rerender
            depy

            Well, the action listener gets invoked but still it doesnt work. The loading panel is showed for the whole time. Seems like that a4j:commandLink oncomplete is never called.

            • 3. Re: ModalPanel self rerender

              Please post your environment. For me it works in FF 3.0.6 and with RF 3.3.1 (some snapshot from beginning of february), Facelets.

              Have you tried to simplify: Put anything out you don't need for that test, for example that chart stuff (I don't know what it is). So you can eliminate the possibility of side effects causing your problem.

              • 4. Re: ModalPanel self rerender
                nbelaevski

                Hello,

                This may be the cause:

                onclick="Richfaces.hideModalPanel('panel');Richfaces.showModalPanel('loadingPanel')"
                Does anything change if you remove this?

                • 5. Re: ModalPanel self rerender
                  depy

                  Still doesnt work. :/

                  • 6. Re: ModalPanel self rerender
                    nbelaevski

                    Can you please check if that works without modal panels?

                    • 7. Re: ModalPanel self rerender
                      depy

                      How do you mean without modal panel. The thing I want is the modal panel to self rerender (that loading panel is just eyecandy not a must). But I can't get it to do that.

                      Later I will try a simple project with just modal panel rerendering it self.

                      • 8. Re: ModalPanel self rerender
                        nbelaevski

                         

                        "nbelaevski" wrote:
                        Can you please check if that works without modal panels?


                        Does oncomplete work if you locate chart:chart not in modal panel, but in another thing, e.g. rich:panel?