5 Replies Latest reply on Sep 11, 2010 4:01 AM by Thorsten Kunz

    4.0-M2: Problem removing the last element of a dataTable

    Thorsten Kunz Novice

      I just started to play around with 4.0 M2 a little and tried to implement a little dataTable with a button in each row that deleted the row and then rerender the table via AJAX. This works just fine for all elements BUT for the last one in the table. When I click "Delete" on the very last item in the table the table is not being rerendered. When I reload the page the item disappears so I guess the call is being executed correctly on the server but the rerendering of the table seems to be broken.

      Here is the managed bean and the jsf page that reproduces the issue:



      <?xml version="1.0" encoding="UTF-8" ?>
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
                      <rich:dataTable id="accountTable" value="#{test.accountList}" var="account">
                              <f:facet name="header">Account</f:facet>
                              <h:outputText value="#{account}" />
                              <f:facet name="header">Action</f:facet>
                              <h:commandButton value="Delete" action="#{test.delete(account)}">
                                  <a4j:ajax event="action" render="accountTable" execute="@this"/>
                      <h:commandButton value="Load Accounts" action="#{test.loadList}">
                          <a4j:ajax event="action" render="accountTable" execute="@this"/>
                      <h:commandButton value="Clear list" action="#{test.clearList}">
                          <a4j:ajax event="action" render="accountTable" execute="@this"/>



      package com.meeb;
      import java.io.Serializable;
      import java.util.ArrayList;
      import java.util.List;
      import javax.annotation.ManagedBean;
      import javax.enterprise.context.SessionScoped;
      import javax.inject.Named;
      public class Test implements Serializable {
          private List<String> accountList = new ArrayList<String>();
          public Test() {
          public List<String> getAccountList() {
              return accountList;
          public void loadList() {
              for (int i = 0; i < 20; i++) {
                  accountList.add("Account " + i);
          public void clearList() {
          public void delete(String account) {



      Is this a bug or am I doing anything wrong?