1 Reply Latest reply on Aug 9, 2010 2:41 AM by Blu3 Ros3

    Problem reRendering parent page after modalPanel closed

    Blu3 Ros3 Newbie

      Hi,

       

      I have two backing beans: MyParentPage.java and MyModalPanel.java.

       

      MyParentPage contains a form that would be populated with data returned from the search result done in the modalPanel. The problem is I can see I the parentPage reRendered correctly (all fields populated with correct values) ONLY if I run my code in debug mode. NOTE: I have breakpoints set in a number of getter() that populate the empty fields. Whenever I run it in the regular mode, only a single field gets populated, the rest remains empty.

       

      Does the reRender work correctly in debug mode because the breakpoint forces the backingBean to run its update process to the UI in series as opposed to parallel? Is there a way I could delay the reRendering of 'parentPanel' until I have received the user data from MyModalPanel backingBean, e.g. userReceived=true?

       

      PS: I've tried to use a4j:push, a4j:support with no luck so I removed them from the code and just tried to reRender the parentPanel when user clicks on the Search button in the ModalPanel.

       

       

       

      Below is my code:

       

      -------------------------------

      MyParentPage.java

      -------------------------------

      public void setUser(MaristUsers user) {

       

              if (user != null){
                  synchronized(user){
                      this.user = user;
                  }
                  userReceived = true;
              }

      }

       

      -------------------------------

      MyModalPanel.java

      -------------------------------

       

      public void doSearch(){

       

           //at this point, user has been found

           MyParentPage parentPage = (MyParentPage) this.getBeanInRequestMap("parentPage");
           parentPage.setUser(user);

      }

       

       

       

      -------------------------------

      MyParentPage.xhtml

      -------------------------------

      <t:panelGrid id="parentPanel" columns="2" border="4" cellpadding="5"
                  bgcolor="#F2F2F2" cellspacing="3" dir="LTR" frame="border"
                  rules="all">

       

                  <h:outputLabel for="userId" value="#{text['user.id']}" styleClass="info" />
                  <h:inputText id="userId" value="#{myParentPage.user.userId}"
                      maxlength="100" required="true" styleClass="text medium" width="500">
                  </h:inputText>

       

                  <h:outputLabel for="firstName" value="#{text['user.firstName']}" styleClass="info" />
                  <h:inputText id="firstName" value="#{myParentPage.user.firstName}"
                      maxlength="100" required="true" styleClass="text medium" width="500">
                  </h:inputText>

       

                  <h:outputLabel for="lastName" value="#{text['user.lastName']}" styleClass="info" />
                  <h:inputText id="lastName" value="#{myParentPage.user.lastName}"
                      maxlength="100" required="true" styleClass="text medium" width="500">
                  </h:inputText>

       

              </t:panelGrid>

       

           <rich:modalPanel id="myModalPanel" minHeight="175" minWidth="300" resizable="true" movable="true">
                  <f:facet name="header">
                      <h:outputText value="LDAP Lookup" />
                  </f:facet>
                  <f:facet name="controls">
                      <span style="cursor: pointer" onclick="javascript:Richfaces.hideModalPanel('myModalPanel')">X</span>
                   </f:facet>
                  <a4j:include viewId="/MyModalPanel.xhtml"/>
           </rich:modalPanel>

       

      -------------------------------

      MyModalPanel.xhtml

      -------------------------------

           <a4j:commandButton id="btnSearch" value="Search"
                      action="#{myModalPanel.doSearch}"
                      style="float:left; height: 30px; width: 120px"
                      process="firstName, lastName"
                      reRender="parentPanel"/>