2 Replies Latest reply on Nov 15, 2007 4:46 PM by Arbi Sookazian

    a4j:support to reRender dataTable and Factory question

    Arbi Sookazian Master

      so I'm using the Factory component pattern on a conversation scoped SFSB. I added a a4j:support tag to a h:selectOneRadio tag and the h:form is reRendered when user clicks 'no' on one of the radioButtons.

      So my question is: does the Factory method execute again when the dataTable is reRendered? It seems it's not refiring based on log output in the server.log. I don't actually want it to, but just curious...

      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
       xmlns:s="http://jboss.com/products/seam/taglib"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:rich="http://richfaces.ajax4jsf.org/rich"
       xmlns:a4j="https://ajax4jsf.dev.java.net/ajax"
       xmlns:c="http://java.sun.com/jstl/core"
       template="layout/template.xhtml">
      
      
      
      <ui:define name="body">
      
       <script type="text/javascript"
       src="seam/resource/remoting/resource/remote.js">
       </script>
      
       <script type="text/javascript"
       src="seam/resource/remoting/interface.js?noteAction">
       </script>
      
       <script type="text/javascript"
       src="seam/resource/remoting/interface.js?securityAuditAction">
       </script>
      
       <script type="text/javascript"
       src="js/securityAudit.js">
       </script>
      
       <h:messages globalOnly="true" styleClass="message"/>
      
       <rich:modalPanel id="mp" minHeight="200" minWidth="450"
       height="500" width="500" zindex="2000">
      
       <f:facet name="header">
       <a4j:form id="a4jHeaderForm">
       <h:outputText id="headerText" value=""/>
       </a4j:form>
       </f:facet>
      
       <a4j:form id="a4jMainForm">
       <h:panelGrid columns="2" style="vertical-align:middle">
       <h:outputText id="description" value=""/>
       <BR/>
       <h:inputTextarea id="noteText" value="#{noteAction.noteText}" rows="6" cols="50"/>
       <!-- hidden variables are null/empty in NoteAction submit method, using Seam remoting -->
      
       <h:inputHidden id="rowIndex" value="noteAction.rowIndex"/>
       <h:inputHidden id="colName" value="noteAction.colName"/>
       <!--
       <h:inputHidden id="siteId" value="noteAction.siteId"/>
       <h:inputHidden id="employeeNumber" value="noteAction.employeeNumber"/>
       -->
       <a4j:commandButton value="submit" action="#{noteAction.submit}" onclick="showNoteGraphic();Richfaces.hideModalPanel('mp')"/>
       <BR/>
       <a4j:commandButton value="cancel" onclick="Richfaces.hideModalPanel('mp');unselectCurrentRadioButton();checkForSubmitFromModalPanel()"/>
       </h:panelGrid>
       </a4j:form>
       </rich:modalPanel>
       <!--
       <rich:panel>
       <a4j:form>
       <h:panelGrid columns="2">
       <h:inputText value="#{noteAction.networkId}"/>
       <a4j:commandButton value="Submit" align="top"/>
       <a4j:status>
       <f:facet name="start">
       <h:graphicImage value="/img/spinner.gif"/>
       </f:facet>
       </a4j:status>
       </h:panelGrid>
       </a4j:form>
       </rich:panel>
       -->
       <rich:panel>
       <h:form id="mainForm">
       <h:outputText value="No Direct Reports" rendered="#{myAuditList != null and myAuditList.rowCount==0}"/>
       <h:dataTable id="dataTable1" value="#{myAuditList}" var="myRow" rendered="#{myAuditList != null and myAuditList.rowCount > 0}"
       styleClass="dataTable" rowClasses="oddRow, evenRow" frame="hsides">
       <h:column>
       <f:facet name="header">Status</f:facet>
      
       <h:graphicImage id="statusImage" value="/img/red.gif"/>
       </h:column>
       <h:column>
       <f:facet name="header">Employee Name</f:facet>
      
       <!-- siteId and employeeNumber hidden fields are used for all radio buttons -->
       <h:outputText id="employeeName" value="#{myRow[0].id.employeeName}"/>
       <h:inputHidden id="employeeNameHidden" value="#{myRow[0].id.employeeName}"/>
       <h:inputHidden id="siteId" value="#{myRow[0].id.siteId}"/>
       <h:inputHidden id="employeeNumber" value="#{myRow[0].id.employeeNumber}"/>
       </h:column>
      
       <h:column>
       <f:facet name="header">SiteId</f:facet>
      
       <h:outputText value="#{myRow[0].id.siteId}"/>
       </h:column>
      
       <h:column>
       <f:facet name="header">EmployeeNumber</f:facet>
      
       <h:outputText value="#{myRow[0].id.employeeNumber}"/>
       </h:column>
      
       <h:column>
       <f:facet name="header">Account Approved?</f:facet>
      
       <h:selectOneRadio id="accountApprovedRB" value="#{myRow[1].icomsAccountApproved}">
       <a4j:support event="onclick"
       oncomplete="showHideRadioButtons(#{myAuditList.getRowIndex()}); processNote(#{myAuditList.getRowIndex()}, 'accountApproved'); checkForSubmit(#{myAuditList.getRowIndex()})"
       action="#{noteAction.setRenderRadioButtons(myAuditList.getRowIndex(), myRow[1].icomsAccountApproved)}"
       reRender="mainForm"
       ajaxSingle="true"/>
      
       <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
       </h:selectOneRadio>
       <h:graphicImage id="acctGraphic" value="/img/icon_edit.gif"
       onclick="editNote(this, #{myAuditList.getRowIndex()}, 'accountApproved');" style="visibility:hidden"/>
       </h:column>
      
       <h:column>
       <f:facet name="header">Security Level Approved?</f:facet>
       <h:selectOneRadio id="securityLevelApprovedRB" value="#{myRow[1].securityLevelApproved}"
       onclick="processNote(#{myAuditList.getRowIndex()}, 'secLevelApproved');checkForSubmit(#{myAuditList.getRowIndex()})"
       rendered="#{noteAction.getRenderRadioButtons(myAuditList.getRowIndex())}">
       <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
       </h:selectOneRadio>
       <h:graphicImage id="securityLevelGraphic" value="/img/icon_edit.gif"
       onclick="editNote(this, #{myAuditList.getRowIndex()}, 'secLevelApproved');" style="visibility:hidden"/>
       </h:column>
      
       <h:column>
       <f:facet name="header">Adjustment Limit Approved?</f:facet>
       <h:selectOneRadio id="adjustmentLimitApprovedRB" value="#{myRow[1].adjustmentLimitApproved}"
       onclick="processNote(#{myAuditList.getRowIndex()}, 'adjLimitApproved');checkForSubmit(#{myAuditList.getRowIndex()})"
       rendered="#{noteAction.getRenderRadioButtons(myAuditList.getRowIndex())}">
       <f:selectItems value="#{securityAuditAction.securityAuditRadioButtons}" />
       </h:selectOneRadio>
       <h:graphicImage id="adjLimitGraphic" value="/img/icon_edit.gif"
       onclick="editNote(this, #{myAuditList.getRowIndex()}, 'adjLimitApproved');" style="visibility:hidden"/>
       </h:column>
      
      
       <h:column>
       <h:commandButton id="submitEmployee" value="Submit" action="#{securityAuditAction.submit}" style="visibility:hidden"/>
       <!-- <f:param name="securityAuditRowNum" value="#{myAuditList.getRowIndex()}"/> -->
       <h:inputHidden id="securityAuditRowNum" value="#{myAuditList.getRowIndex()}"/>
       </h:column>
       </h:dataTable>
      
       </h:form>
       </rich:panel>
      
      </ui:define>
      </ui:composition>