4 Replies Latest reply on Oct 9, 2009 4:41 AM by Some Kid

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

    Some Kid Newbie

      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"
       <h:panelGrid columns="2" rowClasses="prop" width="100%" >
       <s:div><a:form styleClass="association" id="featuresChildren" >
       <rich:dataTable id="featuresTable" value="#{vrataHome.features}"
       rowClasses="rvgRowOne,rvgRowTwo" >
       <rich:column sortBy="#{_features.featCodeDisplayText}">
       <f:facet name="header">Vrata Features</f:facet>
       <h:outputText value="#{_features.featCodeDisplayText}"/>
       <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" />
       <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 ..." />
       <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:log popup="false" level="ALL" style="width: 800px; height: 300px;" rendered="false"/>

      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.