7 Replies Latest reply on Jun 16, 2009 8:24 AM by ashutosh deora

    modelPanel

    ashutosh deora Newbie

      below is my piece of code
      i want to hide modelpanel on completion of a event
      it is not happening
      see can any one tell if i am missing something



      <rich:modalPanel id="panel" width="350" height="100">
       <f:facet name="header">
       <h:panelGroup>
       <h:outputText value="Modal Panel"></h:outputText>
       </h:panelGroup>
       </f:facet>
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/images/modal/close.png"
       styleClass="hidelink" id="hidelink" />
      
       </h:panelGroup>
       </f:facet>
       <a4j:commandButton action="#{journeyPlannerAction.findTrain}"
       reRender="resultBlock" value="Find trains" id="finishbutton"
       ajaxSingle="true">
       <rich:componentControl for="panel" attachTo="finishbutton"
       operation="hide" event="oncomplete" id="callthis" />
       </a4j:commandButton>
       <h:outputText value="Wait"></h:outputText>
       </rich:modalPanel>


        • 1. Re: modelPanel
          Ilya Shaikovsky Master

          there is an issue already in jira. use event attribute itself instead of component control for the event.

          • 2. Re: modelPanel
            ashutosh deora Newbie

            ilya as u said i have called this javascript oncomplete of the button
            but the modelpanel is not going
            am i missing somethign here
            please tell


            <h:form id="nextform">
             <rich:modalPanel id="panel" width="350" height="100" >
             <f:facet name="header">
             <h:panelGroup>
             <h:outputText value="Modal Panel"></h:outputText>
             </h:panelGroup>
             </f:facet>
             <f:facet name="controls">
             <h:panelGroup>
             <a4j:commandButton action="#{journeyPlannerAction.findTrain}"
             reRender="resultBlock" value="Find trains" id="finishbutton"
             ajaxSingle="true" style="display:none" oncomplete="hideModelPanel()">
             </a4j:commandButton>
             <h:outputText value="Wait"></h:outputText>
             </h:panelGroup>
             </f:facet>
             </rich:modalPanel>
             </h:form>



            function hideModelPanel(){
             document.getElementById('nextform:panel').style.display=none;
             }




            • 3. Re: modelPanel
              Ilya Shaikovsky Master

              http://livedemo.exadel.com/richfaces-demo/richfaces/modalPanel.jsf second sample.

              and b.t.w. read about forms limitation for modal panel.

              • 4. Re: modelPanel
                panky_p Novice

                Instead of calling javascript that way why don't you try it simply

                <a4j:commandButton action="#{journeyPlannerAction.findTrain}"
                 reRender="resultBlock" value="Find trains" id="finishbutton"
                 ajaxSingle="true" style="display:none" oncomplete="javascript:Richfaces.hideModalPanel('panel')">



                • 5. Re: modelPanel
                  panky_p Novice

                  BTW instead of using and hiding button use commandLink

                  <f:facet name="controls">
                   <a4j:commandLink action="#{journeyPlannerAction.findTrain}"
                   reRender="resultBlock" value="Find trains" id="finishbutton"
                   ajaxSingle="true" oncomplete="javascript:Richfaces.hideModalPanel('panel')" />
                  </f:facet>


                  • 6. Re: modelPanel
                    panky_p Novice

                    Sorry forgot you put there output text

                    <f:facet name="controls">
                     <a4j:commandLink action="#{journeyPlannerAction.findTrain}"
                     reRender="resultBlock" value="Find trains" id="finishbutton"
                     ajaxSingle="true" oncomplete="javascript:Richfaces.hideModalPanel('panel')" >
                     <h:outputText value="Wait" />
                     </a4j:commandLink >
                    </f:facet>


                    • 7. Re: modelPanel
                      ashutosh deora Newbie

                      panky_p,

                      thank you
                      i also did the same by taking the example of the demo suggested by ILYA

                      its done now
                      thank you onec again