2 Replies Latest reply on Feb 12, 2010 4:02 AM by Ilya Shaikovsky

    Dynamically load a page fragement in rich:outputpanel

    cal kennedy Newbie
      I have a rich:ouputpanel with multiple rich:panel components.  My goal is to load edit.jspf with the data related to the record they select from the grid (Edit button).
      I know that both jspfs are loaded when index.jsp is so right now when edit is clicked edit.jspf will appear but fields will be empty.  Is there any way i can force this page to reload with the correct data?
      I am able to get the record Id from the ActionEvent of Edit click but i am not sure how to force edit.jspf to use that Id to reload the page. 

      My code:
      Index.jsp:
      <div>header</div>
      <div>content
           <h:form>
                <%@include file="main.jspf"%>
           </h:form>
      </div>
      <div> footer</div>


      main.jspf contains:
      <rich:outerpanel id="opMain">
           <rich:panel id="pnlOne" rendered="#{mybean.bOneRendered}">
                <%@include file="grid.jsfp">
           </rich:panel>
           <rich:panel id="pnlTwo" rendered="#{mybean.bTwoRendered}">
                <%@include file="edit.jsfp">
           </rich:panel>
      </rich:outerpanel>


      grid.jspf:
      <subview id="subGrid">
      <rich:dataTable value="#{gridBean.resultset}" var="currentRow">  
           <rich:column>
                <f:facet name="header">
                          <h:outputText value="Last Update>
                </f:facet>
                <h:outputText value="#{currentRow.lastUpdate}"/>
           </rich:column>
           <rich:column>
                <f:facet name="header">
                      <h:outputText value="Edit"/>
                </f:facet>
                <a4j:commandLink value="Edit" actionListener="#{gridBean.lnkEditAction}" data="#{currentRow.Id" reRender="opMain"/>
           </rich:column>
      </rich:dataTable>
      </subview>


      Any ideas?
      Thanks