2 Replies Latest reply on Jan 25, 2009 9:36 PM by sandman202

    a4j:commandButton not reRendering rich:dataTable

    sandman202

      My project was created using seam-gen. It uses Richfaces as well. My project is similar to the format used in Seam-in-Action examples.

      With that said, here is my problem. I have InFilesEdit.xhtml which has an a4j:commandButton to validate some imported records. Within the InFilesEdit.xhtml is a dataTable showing the imported records. When I press the a4j:commandButton the action is performed, which is successful. Once the action is completed, I want the dataTable to be reRendered showing the updated status. However, it does not, unless I refresh my browser.

      I am unable to get this to work properly. How can I get this to work?

      InFilesEdit.xhtml

      <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:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       template="/layout/template.xhtml">
      
      <ui:define name="body">
      
       <a4j:form id="inFilesForm" styleClass="edit" enctype="multipart/form-data">
      
       <rich:panel>
       <f:facet name="header">#{inFilesHome.managed ? 'Edit' : 'Add'} InFiles</f:facet>
      
       <s:decorate id="nameDecoration" template="/layout/display.xhtml">
       <ui:define name="label">Name</ui:define>
       <h:inputTextarea id="name"
       cols="80"
       rows="3"
       disabled="true"
       value="#{inFilesHome.instance.name}"/>
       </s:decorate>
      
       <s:decorate id="typeDecoration" template="/layout/edit.xhtml">
       <ui:define name="label">Type</ui:define>
       <h:selectOneMenu id="inFilesType"
       styleClass="selectOneMenu"
       value="#{inFilesHome.instance.type}"
       disabled="true">
       <s:selectItems value="#{inFilesHome.inFileTypes}" var="inFilesType" label="#{inFilesType.value}"
       noSelectionLabel=""/>
       <s:convertEnum />
       </h:selectOneMenu>
       </s:decorate>
      
       <s:decorate id="statusDecoration" template="/layout/edit.xhtml">
       <ui:define name="label">Status</ui:define>
       <h:selectOneMenu id="inFilesStatus"
       styleClass="selectOneMenu"
       value="#{inFilesHome.instance.status}"
       disabled="true">
       <s:selectItems value="#{inFilesHome.inFileStatuses}" var="inFilesStatus" label="#{inFilesStatus.value}"
       noSelectionLabel=""/>
       <s:convertEnum />
       </h:selectOneMenu>
       </s:decorate>
      
       <s:decorate id="createdOnDecoration" template="/layout/display.xhtml">
       <ui:define name="label">Created On</ui:define>
       <rich:calendar id="createdOn"
       value="#{inFilesHome.instance.createdOn}"
       required="true"
       disabled="true"
       datePattern="MM/dd/yyyy"
       event="onblur"
       reRender="createdOnDecoration"
       style="width: auto;">
       </rich:calendar>
       </s:decorate>
      
      
       <div style="clear:both">
       <span class="required">*</span>
       required fields
       </div>
      
       </rich:panel>
      
      
      
       <div class="actionButtons">
      
       <h:commandButton id="save"
       value="Save"
       action="#{inFilesHome.persist}"
       rendered="#{!inFilesHome.managed}"/>
       <h:commandButton id="delete"
       value="Delete"
       action="#{inFilesHome.remove}"
       immediate="true"
       rendered="#{inFilesHome.managed}"/>
       <s:button propagation="end"
       id="done"
       value="Done"
       view="/admin/InFiles.xhtml"
       rendered="#{inFilesHome.managed}"/>
       <s:button propagation="end"
       id="cancel"
       value="Cancel"
       view="/admin/#{empty inFilesFrom ? 'InFilesList' : inFilesFrom}.xhtml"
       rendered="#{!inFilesHome.managed}"/>
       <a4j:commandButton id="validate"
       value="Validate"
       action="#{inFilesHome.validate}"
       rendered="#{inFilesHome.managed}"
       disabled="#{!inFilesHome.readyForValidation}"
       ajaxSingle="false"
       reRender="out2" />
       <a4j:commandButton id="refresh"
       value="Refresh"
       reRender="inFilesForm,out2"/>
      
       <h:commandButton id="post"
       value="Post"
       action="#{inFilesHome.post}"
       rendered="#{inFilesHome.managed}"
       disabled="#{!inFilesHome.readyForPosting}"/>
       </div>
      
      
      
      <a4j:outputPanel id="out2">
      
       <rich:dataTable id="inCityStateZipList"
       var="_inCityStateZip"
       value="#{inCityStateZipList.resultList}">
      
       <h:column>
       <f:facet name="header">Country</f:facet>
       #{_inCityStateZip.country}
       </h:column>
      
       <h:column>
       <f:facet name="header">City</f:facet>
       #{_inCityStateZip.city}
       </h:column>
      
       <h:column>
       <f:facet name="header">State</f:facet>
       #{_inCityStateZip.province}
       </h:column>
      
       <h:column>
       <f:facet name="header">Zipcode</f:facet>
       #{_inCityStateZip.zipcode}
       </h:column>
      
       <h:column>
       <f:facet name="header">County</f:facet>
       #{_inCityStateZip.county}
       </h:column>
      
       <h:column>
       <f:facet name="header">Status</f:facet>
       #{_inCityStateZip.status.value}
       </h:column>
      
       <h:column>
       <f:facet name="header">Action</f:facet>
       <s:link view="/admin/#{empty from ? 'InCityStateZip' : from}.xhtml"
       value="Select"
       id="inCityStateZip"
       propagation="none">
       <f:param name="inCityStateZipFrom"
       value="#{inCityStateZipFrom}"/>
       <f:param name="inCityStateZipId"
       value="#{_inCityStateZip.id}"/>
       </s:link>
       </h:column>
      
       </rich:dataTable>
      
      
       <div class="tableControl">
      
       <s:link view="/admin/#{inCityStateZipFrom}.xhtml"
       rendered="#{inCityStateZipList.previousExists}"
       value="#{messages.left}#{messages.left} First Page"
       id="inCityStateZipListFirstPage">
       <f:param name="firstResult" value="0"/>
       </s:link>
      
       <s:link view="/admin/#{inCityStateZipFrom}.xhtml"
       rendered="#{inCityStateZipList.previousExists}"
       value="#{messages.left} Previous Page"
       id="inCityStateZipListPreviousPage">
       <f:param name="firstResult"
       value="#{inCityStateZipList.previousFirstResult}"/>
       </s:link>
      
       <s:link view="/admin/#{inCityStateZipFrom}.xhtml"
       rendered="#{inCityStateZipList.nextExists}"
       value="Next Page #{messages.right}"
       id="inCityStateZipListNextPage">
       <f:param name="firstResult"
       value="#{inCityStateZipList.nextFirstResult}"/>
       </s:link>
      
       <s:link view="/admin/#{inCityStateZipFrom}.xhtml"
       rendered="#{inCityStateZipList.nextExists}"
       value="Last Page #{messages.right}#{messages.right}"
       id="inCityStateZipListLastPage">
       <f:param name="firstResult"
       value="#{inCityStateZipList.lastFirstResult}"/>
       </s:link>
      
       </div>
      
      
      </a4j:outputPanel>
      
      </a4j:form>
      
      
      
      
      </ui:define>
      
      </ui:composition>
      


        • 1. Re: a4j:commandButton not reRendering rich:dataTable
          nbelaevski

          Hello,

          Please add

          <a4j:log popup="false" />
          to the page and check if there are any errors/warnings there.

          • 2. Re: a4j:commandButton not reRendering rich:dataTable
            sandman202

            I added the a4j:log and this is the results. I did not see any errors or warnings.


            debug[20:28:34,128]: Have Event [object Object] with properties: target: [object HTMLInputElement], srcElement: undefined, type: click
            debug[20:28:34,128]: NEW AJAX REQUEST !!! with form :inFilesForm
            debug[20:28:34,129]: Append textarea control inFilesForm:nameDecoration:name with value [ZIP_CODES_SMALL.txt] and value attribute [null]
            debug[20:28:34,130]: Append select-one control inFilesForm:typeDecoration:inFilesType with value [STD_CITYSTATEZIP] and value attribute [null]
            debug[20:28:34,130]: Append select-one control inFilesForm:statusDecoration:inFilesStatus with value [IMPORTED] and value attribute [null]
            debug[20:28:34,130]: Append text control inFilesForm:createdOnDecoration:createdOnInputDate with value [01/24/2009] and value attribute [01/24/2009]
            debug[20:28:34,131]: Append hidden control inFilesForm:createdOnDecoration:createdOnInputCurrentDate with value [01/2009] and value attribute [01/2009]
            debug[20:28:34,131]: Append hidden control inFilesForm with value [inFilesForm] and value attribute [inFilesForm]
            debug[20:28:34,132]: Append hidden control autoScroll with value [] and value attribute []
            debug[20:28:34,132]: Append hidden control javax.faces.ViewState with value [j_id4] and value attribute [j_id4]
            debug[20:28:34,133]: parameter inFilesForm:validate with value inFilesForm:validate
            debug[20:28:34,133]: Start XmlHttpRequest
            debug[20:28:34,134]: Reqest state : 1
            debug[20:28:34,134]: QueryString: AJAXREQUEST=_viewRoot&inFilesForm%3AnameDecoration%3Aname=ZIP_CODES_SMALL.txt&inFilesForm%3AtypeDecoration%3AinFilesType=STD_CITYSTATEZIP&inFilesForm%3AstatusDecoration%3AinFilesStatus=IMPORTED&inFilesForm%3AcreatedOnDecoration%3AcreatedOnInputDate=01%2F24%2F2009&inFilesForm%3AcreatedOnDecoration%3AcreatedOnInputCurrentDate=01%2F2009&inFilesForm=inFilesForm&autoScroll=&javax.faces.ViewState=j_id4&inFilesForm%3Avalidate=inFilesForm%3Avalidate&
            debug[20:28:34,135]: Reqest state : 1
            debug[20:28:36,701]: Reqest state : 2
            debug[20:28:36,702]: Reqest state : 3
            debug[20:28:36,704]: Reqest state : 3
            debug[20:28:36,705]: Reqest state : 3
            debug[20:28:36,707]: Reqest state : 3
            debug[20:28:36,708]: Reqest state : 3
            debug[20:28:36,710]: Reqest state : 3
            debug[20:28:36,711]: Reqest state : 3
            debug[20:28:36,711]: Reqest state : 4
            debug[20:28:36,712]: Reqest end with state 4
            debug[20:28:36,712]: Response with content-type: text/xml;charset=UTF-8
            debug[20:28:36,713]: Full response content: <?xml version="1.0"?> Created On //<![CDATA[ new Calendar('inFilesForm:createdOnDecoration:createdOn', {dayListTableId: 'inFilesForm:createdOnDecoration:createdOnDay', weekNumberBarId: 'inFilesForm:createdOnDecoration:createdOnWeekNum', weekDayBarId: 'inFilesForm:createdOnDecoration:createdOnWeekDay', currentDate: new Date(2009,0,1), selectedDate: new Date(2009,0,24,0,0,0), datePattern: 'MM/dd/yyyy', jointPoint: 'bottom-left', direction: 'bottom-right', toolTipMode:'batch', boundaryDatesMode:'inactive', popup: true, enableManualInput: false, showInput: true, disabled: true, ajaxSingle: true, verticalOffset:0, horizontalOffset: 0, style:'z-index: 3; width: auto;', firstWeekDay: 0, minDaysInFirstWeek: 1, todayControlMode:'select', showHeader:true, showFooter:true, showWeeksBar:true, showWeekDaysBar:true, showApplyButton:false, resetTimeOnDateSelect:false, defaultTime:{hours:12,minutes:0}, labels:{apply:'Apply', today:'Today', clean:'Clean', cancel:'Cancel', ok:'OK', close:'x'}, 'monthLabels': ['January','February','March','April','May','June','July','August','September','October','November','December'] , 'monthLabelsShort': ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] , 'weekDayLabels': ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] , 'weekDayLabelsShort': ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] }).load(); //]]> CountryCityStateZipcodeCountyStatusActionUnited StatesHOLTSVILLENY00501SUFFOLKNewSelectUnited StatesHOLTSVILLENY00544SUFFOLKNewSelectADJUNTASPR00601ADJUNTASNewSelectAGUADAPR00602AGUADANewSelectAGUADILLAPR00603AGUADILLANewSelectAGUADILLAPR00604AGUADILLANewSelectAGUADILLAPR00605AGUADILLANewSelectMARICAOPR00606MARICAONewSelectANASCOPR00610ANASCONewSelectANGELESPR00611UTUADONewSelectARECIBOPR00612ARECIBONewSelectARECIBOPR00613ARECIBONewSelectARECIBOPR00614ARECIBONewSelectBAJADEROPR00616ARECIBONewSelectBARCELONETAPR00617BARCELONETANewSelectBOQUERONPR00622CABO ROJONewSelectCABO ROJOPR00623CABO ROJONewSelectPENUELASPR00624PENUELASNewSelectCAMUYPR00627CAMUYNewSelectCASTANERPR00631LARESNewSelectROSARIOPR00636SAN GERMANNewSelectSABANA GRANDEPR00637SABANA GRANDENewSelectCIALESPR00638CIALESNewSelectUTUADOPR00641UTUADONewSelectDORADOPR00646DORADONewSelect Next Page ›Last Page ››
            debug[20:28:36,715]: Header Ajax-Expired not found, search in
            debug[20:28:36,715]: search for elements by name 'meta' in element #document
            debug[20:28:36,716]: Find
            debug[20:28:36,716]: Find
            debug[20:28:36,716]: Header Ajax-Update-Ids not found, search in
            debug[20:28:36,716]: search for elements by name 'meta' in element #document
            debug[20:28:36,717]: Find
            debug[20:28:36,717]: Update page by list of rendered areas from response inFilesForm:createdOnDecoration,inFilesForm:out2
            debug[20:28:36,717]: search for elements by name 'script' in element #document
            debug[20:28:36,718]: search for elements by name 'link' in element #document
            debug[20:28:36,719]: in response with src=/artwork/a4j/s/3_2_2.SR1stylesheet/theme.xcss/DATB/eAF7sqpgb-jyGdIAFrMEaw__
            debug[20:28:36,719]: Such element exist in document
            debug[20:28:36,719]: in response with src=/artwork/stylesheet/theme.css
            debug[20:28:36,720]: Such element exist in document
            debug[20:28:36,720]: Update page part from call parameter for ID inFilesForm:createdOnDecoration
            debug[20:28:36,720]: call getElementById for id= inFilesForm:createdOnDecoration
            debug[20:28:36,733]: Replace content of node by replaceChild()
            debug[20:28:36,735]: search for elements by name 'script' in element div
            debug[20:28:36,735]: Scripts in updated part count : 1
            debug[20:28:36,736]: Update part of page for Id: inFilesForm:createdOnDecoration successful
            debug[20:28:36,736]: Update page part from call parameter for ID inFilesForm:out2
            debug[20:28:36,736]: call getElementById for id= inFilesForm:out2
            debug[20:28:36,785]: Replace content of node by replaceChild()
            debug[20:28:36,797]: search for elements by name 'script' in element span
            debug[20:28:36,797]: Scripts in updated part count : 0
            debug[20:28:36,798]: call getElementById for id= org.ajax4jsf.oncomplete
            debug[20:28:36,798]: Update part of page for Id: inFilesForm:out2 successful
            debug[20:28:36,799]: call getElementById for id= ajax-view-state
            debug[20:28:36,799]: Hidden JSF state fields: [object HTMLSpanElement]
            debug[20:28:36,800]: Namespace for hidden view-state input fields is undefined
            debug[20:28:36,800]: search for elements by name 'input' in element span
            debug[20:28:36,801]: Replace value for inputs: 10 by new values: 1
            debug[20:28:36,801]: Input in response: javax.faces.ViewState
            debug[20:28:36,802]: Found same input on page with type: hidden
            debug[20:28:36,803]: search for elements by name 'INPUT' in element span
            debug[20:28:36,803]: Replace value for inputs: 10 by new values: 0
            debug[20:28:36,804]: call getElementById for id= _A4J.AJAX.focus
            debug[20:28:36,804]: No focus information in response
            debug[20:28:36,877]: Evaluate script replaced area in document: // new Calendar('inFilesForm:createdOnDecoration:createdOn', {dayListTableId: 'inFilesForm:createdOnDecoration:createdOnDay', weekNumberBarId: 'inFilesForm:createdOnDecoration:createdOnWeekNum', weekDayBarId: 'inFilesForm:createdOnDecoration:createdOnWeekDay', currentDate: new Date(2009,0,1), selectedDate: new Date(2009,0,24,0,0,0), datePattern: 'MM/dd/yyyy', jointPoint: 'bottom-left', direction: 'bottom-right', toolTipMode:'batch', boundaryDatesMode:'inactive', popup: true, enableManualInput: false, showInput: true, disabled: true, ajaxSingle: true, verticalOffset:0, horizontalOffset: 0, style:'z-index: 3; width: auto;', firstWeekDay: 0, minDaysInFirstWeek: 1, todayControlMode:'select', showHeader:true, showFooter:true, showWeeksBar:true, showWeekDaysBar:true, showApplyButton:false, resetTimeOnDateSelect:false, defaultTime:{hours:12,minutes:0}, labels:{apply:'Apply', today:'Today', clean:'Clean', cancel:'Cancel', ok:'OK', close:'x'}, 'monthLabels': ['January','February','March','April','May','June','July','August','September','October','November','December'] , 'monthLabelsShort': ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'] , 'weekDayLabels': ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'] , 'weekDayLabelsShort': ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'] }).load(); //