1 Reply Latest reply on Oct 8, 2009 11:48 AM by sam-user

    Re-rendering doesn't work on rich:dataTable when empty

    sam-user

      Hello,
      I came across a very strange problem with re-rendering a dataTable.

      I have a dataTable that displayes feature items assciated with an instance of an entity. I delete an item from this list by clicking on the Delete command link. This removes the corresponding value from the database, refreshes the instance of the entity and reRenderes the data table.
      Here's my page:

      <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:a="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
       <h:panelGrid columns="2" rowClasses="prop" width="100%" >
       <s:div><a:form styleClass="association" id="featuresChildren" >
      
       <rich:dataTable id="featuresTable" value="#{vrataHome.features}"
       var="_features"
       rowClasses="rvgRowOne,rvgRowTwo" >
      
       <rich:column sortBy="#{_features.featCodeDisplayText}">
       <f:facet name="header">Vrata Features</f:facet>
       <h:outputText value="#{_features.featCodeDisplayText}"/>
       </rich:column>
      
       <rich:column rendered="#{vrataHome.instance.vrataDeletedDate==null}" visible="#{disFields}">
       <a:commandLink value="Remove" status="waitStatus"
       id="removeFeat" action="#{vrataFeaturesHome.removeFeature}" >
       <f:param name="featCode" value="#{_features.featCode}"/>
       <a:support event="oncomplete" reRender="featuresTable" />
       </a:commandLink>
       </rich:column>
      
       </rich:dataTable>
       </a:form></s:div>
      
       <s:div rendered="#{disFields}">
       <a:form id="vrataFeatures" styleClass="edit" >
       <s:decorate id="featCodeField" template="layout/edit.xhtml">
       <ui:define name="label">Features</ui:define>
       <h:selectOneMenu value="#{vrataFeaturesHome.instance.id.featCode}" onselect="">
       <s:selectItems value="#{featuresList.resultList}" var="_f" label="#{_f.featCodeDisplayText}"
       itemValue="#{_f.featCode}" noSelectionLabel="Select feature ..." />
       </h:selectOneMenu>
       </s:decorate>
      
       <a:commandLink id="save" value="Add" action="#{vrataFeaturesHome.addFeature}" status="waitStatus" >
       <f:param name="featCode" value="#{vrataFeaturesHome.instance.id.featCode}"/>
       <a:support event="oncomplete" reRender="featuresTable" />
       </a:commandLink>
       </a:form>
       <a:log popup="false" level="ALL" style="width: 800px; height: 300px;" rendered="false"/>
       </s:div>
       </h:panelGrid>
      </ui:composition>
      
      


      in my vrataFeaturesHome class I have addFeature and removeFeature methods that add or remove a feature item from my Vrata entity and refresh the Vrata instance.

      It all works well untill I remove the last feature from the list. At that point the feature item is correctly deleted from my DB, but the dataTable is not being rendered correctly - it still shows the item that was just removed.

      Could someone pease help me as to what might be causing this problem. Thanks.