4 Replies Latest reply on Jan 17, 2008 2:14 PM by gerch

    Modal Panel and ReRender

      Hi

      I have a jsf page in REQUEST SCOPE which has a datatable and hiddne modal panel ...

      if i click on an edit button now i want to open the modal panel and fill in the correct values from that row... i have set a currentRow object in my backing bean before opening the modal panel and then set a rerender on the modal panel to show the values.

      here a code snippet

      <rich:dataTable width="100%" id="homeEntries" value="#{adminHome}" var="item" rows="20" rowKeyVar="rowNum">

      ...

      <rich:column style="align: center">
      <f:facet name="header">
      <h:outputText value=""/>
      </f:facet>
      <a4j:commandLink id="modify" actionListener="#{adminHome.prepareModify}" value="modifyRow" onclick="Richfaces.showModalPanel('newHomeEntry',{top:200})" reRender="newHomeEntry">
      <a4j:actionparam name="rowNum" value="#{rowNum}"></a4j:actionparam>
      </a4j:commandLink>
      </rich:column>
      ...

      <rich:modalPanel id="newHomeEntry" zindex="2000" autosized="true" >
      ... bla bla bla ...
      </rich:modalPanel>

      </rich:dataTable>

      The problem is now that since its a request scope the modal panel hides again as soon as the rerender on it is called ...

      can anyone help ?

      sorry for my english :)

        • 1. Re: Modal Panel and ReRender

          oh ok

          i solved the problem...

          for people that are interested in the solution:

          dont rerender the whole modalPanel but for example an panelgrid that is included.

          <a4j:commandLink id="modify" actionListener="#{adminHome.prepareModify}" value="modifyRow" onclick="Richfaces.showModalPanel('newHomeEntry',{top:200})" reRender="insidePanel">

          ...

          <rich:modalPanel id="newHomeEntry" zindex="2000" autosized="true" >
          ...
          <h:panelGroup id="insidePanel"/>
          ...
          </rich:modalPanel>

          • 2. Re: Modal Panel and ReRender

            instead of pointing to the modalPanel id, point to the any component inside the modalPanel that is going to be reRendered. For example, wrap the content of the modal panel with h:panelGroup (h:panelGrid, a4j:outputPanel or what ever) and point to it. In this case, first, the modal panel appears, then, after the response is done, the content of it just uploaded with actual value.
            If you do not want to show the panel before the actual content come, use oncomplete instead of onclick

            • 3. Re: Modal Panel and ReRender

              Ok. :-) You was faster with your own solution. Please, just consider that h:panelGroup render < span >< /span > by default. If you content contain any block tags, it is not correct to wrap them with span (according to the html standards). The solution is using < h:panelGroup style="display:block" >

              • 4. Re: Modal Panel and ReRender

                cool thank you for the info