3 Replies Latest reply on Jun 11, 2009 8:01 PM by avaldez314

    How to reset the initial viewId of a a4j:include ?

      Hello, I'm following the RichFaces suggestion of doing a wizard inside a rich:modalPanal using a a4j:include, the wizard lets the user navigate the 3 steps of the create operation. That works ok.

      If the user close de modal panel, say in step 2, and then start again the wizard it starts in the step where de user closed the modalPanel.

      I would like to make the wizard start again in the first step defined in the a4j:include viewId property.

      Do anyone know how can I do that?

      Any suggestion will be appreciated.




       <h:form>
       <a4j:commandLink ajaxSingle="true" id="createlink"
       oncomplete="#{rich:component('createPanel')}.show()">
       <h:outputText value="Create new"/>
       </a4j:commandLink>
       </h:form>
      
      
       <rich:modalPanel id="createPanel">
       <f:facet name="controls">
       <h:panelGroup>
       <h:graphicImage value="/images/icons/close.png" id="hidelink"
       styleClass="hidelink" />
       <rich:componentControl for="createPanel" attachTo="hidelink"
       operation="hide" event="onclick" />
       </h:panelGroup>
       </f:facet>
      
       <a4j:outputPanel ajaxRendered="true">
       <a4j:include id="createWizard"
       viewId="/pages/wizards/createStep1.xhtml"/>
       </a4j:outputPanel>
      
       </rich:modalPanel>
      


        • 1. Re: How to reset the initial viewId of a a4j:include ?
          ilya_shaikovsky

          Define the viweId of include using EL expression and reset it when needed.

          • 2. Re: How to reset the initial viewId of a a4j:include ?

             

            "ilya_shaikovsky" wrote:
            Define the viweId of include using EL expression and reset it when needed.


            Thank you for the suggestion, but I'm afraid that it didn't work. I tried it, and even added the modalPanel and child components in the reRender property of the a4j:commandLink that initiates the wizard.

            If I put a breakpoint in the createBean.getWizardStep1ViewId() it's only called when the page is first loaded and when changing from the first page of the wizard to the next page.

            Any other workaround? I'm kind of lost :-(



             <h:form>
             <a4j:commandLink ajaxSingle="true" id="createlink"
             oncomplete="#{rich:component('createPanel')}.show()"
            reRender="cratePanel,createWizardPanel,createWizard">
             <h:outputText value="Create new"/>
             </a4j:commandLink>
             </h:form>
            
            
             <rich:modalPanel id="createPanel">
             <f:facet name="controls">
             <h:panelGroup>
             <h:graphicImage value="/images/icons/close.png" id="hidelink"
             styleClass="hidelink" />
             <rich:componentControl for="createPanel" attachTo="hidelink"
             operation="hide" event="onclick" />
             </h:panelGroup>
             </f:facet>
            
             <a4j:outputPanel id="createWizardPanel "ajaxRendered="true">
             <a4j:include id="createWizard"
             viewId="#{createBean.wizardStep1ViewId}"/>
             </a4j:outputPanel>
            
             </rich:modalPanel>
            


            • 3. Re: How to reset the initial viewId of a a4j:include ? (SOLV

               

              "avaldez314" wrote:
              "ilya_shaikovsky" wrote:
              Define the viweId of include using EL expression and reset it when needed.


              Thank you for the suggestion, but I'm afraid that it didn't work. I tried it, and even added the modalPanel and child components in the reRender property of the a4j:commandLink that initiates the wizard.

              If I put a breakpoint in the createBean.getWizardStep1ViewId() it's only called when the page is first loaded and when changing from the first page of the wizard to the next page.

              Any other workaround? I'm kind of lost :-(



               <h:form>
               <a4j:commandLink ajaxSingle="true" id="createlink"
               oncomplete="#{rich:component('createPanel')}.show()"
              reRender="cratePanel,createWizardPanel,createWizard">
               <h:outputText value="Create new"/>
               </a4j:commandLink>
               </h:form>
              
              
               <rich:modalPanel id="createPanel">
               <f:facet name="controls">
               <h:panelGroup>
               <h:graphicImage value="/images/icons/close.png" id="hidelink"
               styleClass="hidelink" />
               <rich:componentControl for="createPanel" attachTo="hidelink"
               operation="hide" event="onclick" />
               </h:panelGroup>
               </f:facet>
              
               <a4j:outputPanel id="createWizardPanel "ajaxRendered="true">
               <a4j:include id="createWizard"
               viewId="#{createBean.wizardStep1ViewId}"/>
               </a4j:outputPanel>
              
               </rich:modalPanel>
              




              Holding the viewId in a property of a managed bean and reseting it in an actionEvent when starting the wizard solve the issue.

              My mistake was that I only created the getter and not the setter for the property that holds the viewId, it seems that the a4j:include also needs the setter to work properly.