2 Replies Latest reply on Mar 2, 2010 6:42 AM by nbelaevski

    a4j:commandlink only works fires actionlistener event the first time

      I have an index.jsp that is structured as follows:

      <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" binding="#{mybean.pnlOne}" rendered="true">

                <%@include file="grid.jsfp">

           </rich:panel>

           <rich:panel id="pnlTwo" binding="#{mybean.pnlTwo}" rendered="false">

                <%@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>

       

      edit.jspf:

      <subview id="subEdit">

         <h:inputtext id="txtFirstName" binding="#{editBean.FirstName}"/>

         <h:inputtext id="txtLastName" binding="#{editBean.LastName}"/>

         <h:inputtext id="txtPhoneNum" binding="#{editBean.PhoneNum}"/>

      </subview>

       

      The editBean properties are determined by the record selected in the dataTable by clicking the Edit commandLink.

      The first time the dataTable is renedred pnlOne is rendered.  When the user clicks the Edit link in the datatable pnlOne setRenedred is set to false

      and pnlTwo setrendered = true.

      There is a link at the top of the page that takes the user pack to the grid page (ie. pnlOne rendered = true, pnlTwo rendered = false).

      All of that works fine.  However, after the user is taken back to the grid page the Edit link will not work again.

      The Edit linkcommand only works the first time the site is loaded.

       

      Any ideas why the Edit linkCommand actionlistener is not being fired after the panels are rerendered a second time?