2 Replies Latest reply on Apr 26, 2008 3:41 AM by Stefan Mohr

    h:dataTable combined with nested a4j:outputPanel & a4j:suppo

    Guillaume Jeudy Master

      Hi,

      I am using richfaces 3.2.0 with seam 2.0.1 in JBoss 4.2.2 AS. I cannot get AJAX validation working when nested a4j:outputPanel & a4j:support in a h:dataTable.



      <h:form id="domainInstancesForm">
       <h:dataTable var="domInstance"
       value="#{activeDomain.referenceDomainInstances}">
       <h:column>
       <f:facet name="header">
       <h:outputText value="Valid from date" />
       </f:facet>
       <a4j:outputPanel id="outpanevalidFromDate" >
       <div class="entry">
       <s:label styleClass="label #{invalid?'errors':''}">
       <s:span styleClass="required">*</s:span>
       </s:label>
       <span class="input #{invalid?'errors':''}">
       <s:validateAll>
       <h:inputText id="validFromDate" value="#{domInstance.validityPeriod.validFromDate}" required="true">
       <a4j:support event="onblur" reRender="outpanevalidFromDate">
       </a4j:support>
       </h:inputText>
       </s:validateAll>
       </span>
       <s:message styleClass="errors"/>
       </div>
       </a4j:outputPanel>
       </h:column>
       </h:dataTable>
       </h:form>


      I turned on a4j:log debug output and I get the following suspicious entry:

      warn[13:54:27,578]: Node for replace by response with id domainInstancesForm:j_id90:outpanevalidFromDate not found in document


      I verified in the generated HTML and the corresponding a4j:outputpane expressed as an HTML span tag yields the following id: domainInstancesForm:j_id90:0:outpanevalidFromDate.

      This solution works fine in a regular form with no h:dataTable.

      So my question here is a4j:support useable in a dataTable context? It seems to me that it is not aware of the dataTable rowIndex which is used to generate the outputpane id. ex: domainInstancesForm:j_id90:0:outpanevalidFromDate.

      Thanks,
      -Guillaume

        • 1. Re: h:dataTable combined with nested a4j:outputPanel & a4j:s
          Stefan Mohr Newbie

          I'm having issues with a4j:support in a datatable as well.
          Like Guillaume I have a4j:support in a table but am using a rich:dataTable and have my a4j:support tag attached to a commandLink in a table row:

          <rich:dataTable value="#{Bean.selectedUsers}" var="user">
           <rich:column>
           <f:facet name="header">
           <h:outputText value="Username" />
           </f:facet>
           <h:outputText value="#{user.username}" />
           </rich:column>
           <rich:column>
           <h:commandLink value="Remove">
           <a4j:support event="onclick" reRender="thisPanel" action="#{Bean.unselectUser}" actionListener="#{user.selectUserItem}" />
           </h:commandLink>
           </rich:column>
          </rich:dataTable>
          


          I have a combobox control inside this frame which has the same behaviour and backing code as this (except that it adds users to the table) and is working 100%.
          The code above is also working for me, except that the reRender never happens - I can see that my collections are updated properly when the actions are fired, but they don't update until I trigger a screen rerender through a different control. The only difference I can see is that this a4j:support is inside a dataTable.

          Are we both coming up against a bug in a4j:support or data tables?

          • 2. Re: h:dataTable combined with nested a4j:outputPanel & a4j:s
            Stefan Mohr Newbie

            Yikes, minutes later I solved my own problem myself - I changed my h:commandLink to a4j:commandLink and things are working as expected.

            Sorry to Guillaume for butting into his issue - clearly we weren't having the same problem!