4 Replies Latest reply on Nov 10, 2009 2:01 PM by Sonya Ling

    reRender in a4j:commandLink is not working

    Sonya Ling Newbie

      Need some help.
      I have JSF codes as the followings:
      It will call backing bean Dashboard2Bean publish function to update publish status in database then re-fetch data then rerender the same table cell to refresh publish status.
      I verified that backing bean Dashboard2Bean publish is working.
      I specify the reRender attribute as dashboard_cell_45768_35 if the id of containing table cell is dashboard_cell_45768_35 in a4j:commandLink. Also I set limitToList="true" ajaxSingle="true". I inspect it under Firebug. Everything looks O.K. However, reRender is not working.

      <t:dataList id="subProfileList" var="profileAssoc" value="#{product.dashboardProfileAssocs}" rowIndexVar="currentRow">
       <td id="dashboard_cell_<h:outputText value="#{product.id}" />_<h:outputText value="#{profileAssoc.profile.id}" />" >
       <t:outputText rendered="#{profileAssoc.displayStatus == 'Pending'}">
       <img src="/panda/images/dashboard/icon_status_mini_pending.png" alt="Pending" />
       <a4j:commandLink reRender="dashboard_cell_#{product.id}_#{profileAssoc.profile.id}" action="#{Dashboard2Bean.publish}" limitToList="true" ajaxSingle="true" value="publish">
       <img src="/panda/images/dashboard/icon_menu_publish.png"
       <f:param name="publishProductId" value="#{product.id}"/>
       <f:param name="publishProfileId" value="#{profileAssoc.profile.id}"/>
       </a4j:commandLink>
       </t:outputText>
       <t:outputText rendered="#{profileAssoc.displayStatus == 'Published'}">
       <img src="/panda/images/dashboard/icon_status_mini_published.png" alt="Published" />
       </t:outputText>
       <t:outputText rendered="#{profileAssoc.displayStatus == 'Expired'}">
       <img src="/panda/images/dashboard/icon_status_mini_expired.png" alt="Expired" />
       </t:outputText>
       </td>
      </t:dataList>
      


        • 1. Re: reRender in a4j:commandLink is not working
          Ilya Shaikovsky Master

          This will work only using a4j data iteration components. tomahawk UIData just not provides any mechanisms to update them partially.

          • 2. Re: reRender in a4j:commandLink is not working, resolved, bu
            Sonya Ling Newbie

            I get partial render work beautifully by replacing <t:dataList> in both outer loop and inner loop with <rich:dataList> and also add ajaxKeys in both <rich:dataList>.

            However, I get into new bug after I switch to <rich:dataList> . Dashboard view render well when I display the first time. When I switch date and re-fetch data and display the second time, I got
            java.lang.IllegalStateException: duplicate Id for a component dashboardForm:productList:subProfileList:j_id61
            org.ajax4jsf.application.AjaxStateManager$TreeStrutureNode.apply(AjaxStateManager.java:418)
            org.ajax4jsf.application.AjaxStateManager$TreeStrutureNode.apply(AjaxStateManager.java:440)
            org.ajax4jsf.application.AjaxStateManager.buildSerializedView(AjaxStateManager.java:328)
            org.ajax4jsf.application.AjaxStateManager.saveSerializedView(AjaxStateManager.java:312)
            javax.faces.application.StateManager.saveView(StateManager.java:166)
            com.sun.faces.application.ViewHandlerImpl$WriteBehindStateWriter.flushToWriter(ViewHandlerImpl.java:925)
            com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:205)
            org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)

            I specify add whenever I can. I still got the same error. What should I do ?
            The followings are codes excerpt

            <tbody>
             <!-- Start the product listing. -->
             <rich:dataList id="productList" value="#{Dashboard2Bean.productList}" var="product" rowKeyVar="row" rowClasses="even, odd"
             binding="#{Dashboard2Bean.selectedProduct}" ajaxKeys="#{Dashboard2Bean.productIndexToUpdate}" >
             <tr id="dashboardRow">
             <td class="wrpFirst">
            
             <h:commandLink action="#{Dashboard2Bean.productClick}" immediate="true">
             <h:outputText value="#{product.productName}" />
             </h:commandLink>
             </td>
             <td>
             <h:outputText value="#{product.id}" />
             </td>
             <rich:dataList id="subProfileList" var="profileAssoc" value="#{product.dashboardProfileAssocs}" binding="#{Dashboard2Bean.selectedProfile}" ajaxKeys="#{Dashboard2Bean.profileIndexToUpdate}" >
             <td id="dashboardColumn">
             <a4j:outputPanel id="dashboardPanel">
             <t:outputText rendered="#{profileAssoc.compositeStatus == 1}">
             <a id="dashboardPeningAnchor">
             <img src="/panda/images/dashboard/icon_status_mini_pending.png" alt="Pending" />
             </a>
             <a4j:commandLink id="dashboardPublishAnchor" reRender="dashboardPanel" action="#{Dashboard2Bean.publish}" limitToList="true" ajaxSingle="true" value="publish">
             <img src="/panda/images/dashboard/icon_menu_publish.png"
             </a4j:commandLink>
             <a id="dashboardPendingExportAnchor" href="javascript:exportDirect('<h:outputText value="#{product.id}" />', '<h:outputText value="#{profileAssoc.profile.id}" />')">
             <img src="/panda/images/dashboard/icon_menu_export.png" />export
             </a>
             </t:outputText>
             <t:outputText rendered="#{profileAssoc.compositeStatus == 2}">
             <a id="dashboardPublishedAnchor" >
             <img src="/panda/images/dashboard/icon_status_mini_published.png" alt="Published" />
             </a>
             <a id="dashboardPublishedExportAnchor" href="javascript:exportDirect('<h:outputText value="#{product.id}" />', '<h:outputText value="#{profileAssoc.profile.id}" />')">
             <img src="/panda/images/dashboard/icon_menu_export.png" />export
             </a>
             </t:outputText>
             <t:outputText rendered="#{profileAssoc.compositeStatus == 3}">
             <a id="dashboardExpiredAnchor" >
             <img src="/panda/images/dashboard/icon_status_mini_expired.png" alt="Expired" />
             </a>
             <a id="dashboardExpiredExportAnchor" href="javascript:exportDirect('<h:outputText value="#{product.id}" />', '<h:outputText value="#{profileAssoc.profile.id}" />')">
             <img src="/panda/images/dashboard/icon_menu_export.png" />export
             </a>
             </t:outputText>
             </a4j:outputPanel>
             </td>
             </rich:dataList>
             </tr>
             <%-- </t:outputText> --%>
             </rich:dataList>
            
             </tbody>


            • 3. Re: reRender in a4j:commandLink is not working
              Ilya Shaikovsky Master

              seems you using session scoped binding. It will not works fine in JSF in general.

              • 4. Re: reRender in a4j:commandLink is not working
                Sonya Ling Newbie

                Yes. You are absolutely right. I took out the binding and replace ithem with passing parameters this morning. It's working now.
                Thanks.