0 Replies Latest reply on Jan 24, 2008 12:15 PM by Rainer Sinkwitz

    dataGrid in dataTable re-display bug on conversion/validatio

    Rainer Sinkwitz Newbie

      I have a rich:dataGrid embedded in a dataTable (h: or rich:). When validation or conversion errors happen, then input field values in the nested dataGrid tables are lost (refreshed from backing bean) for all nested dataGrids except for the one(s) where error(s) happens.

      This can be shown by the following code:

      ---- richdatagriderrortest.jsp --------------------------------
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>


      <h:form id="form">
      <h1>Test page</h1>
      <h:dataTable id="c1" border="1" value="#{testBean.tables}" var="table">
      <rich:dataGrid id="c2" columns="2" value="#{table.cells}" var="cell">
      <h:outputLabel value="Value:" for="field" />
      <h:inputText id="field" value="#{cell.value}" />
      <h:messages />
      <h:commandButton action="#{testBean.submit}" value="Submit" />


      --- TestBean.java -------------------------
      import java.util.ArrayList;
      import java.util.List;

      public class TestBean {

      private List tables = new ArrayList();

      public TestBean() {
      Table t1 = new Table();
      t1.getCells().add(new Cell());
      t1.getCells().add(new Cell());

      Table t2 = new Table();
      t2.getCells().add(new Cell());
      t2.getCells().add(new Cell());

      public String submit() {
      return null;

      public List getTables() {
      return tables;

      public void setTables(List tables) {
      this.tables = tables;

      --- Table.java ------------------------------------------
      import java.util.ArrayList;
      import java.util.List;

      public class Table {
      private List cells = new ArrayList();

      public List getCells() {
      return cells;

      public void setCells(List cells) {
      this.cells = cells;

      --- Cell.java -------------------------------------------------------------------
      public class Cell {
      private Integer value;

      public Integer getValue() {
      return value;

      public void setValue(Integer value) {
      this.value = value;


      ------------------------------ end of code -----------------

      To see the error, enter some digits into some fields, some characters into others and submit.

      This is really a critical problem for my application which is using quite dynamic forms.

      With best regards, Rainer

      Rainer Sinkwitz, Ph.D. Senior Consultant Software Engineering, IS Applications, ABB Schweiz AG
      Phone: +41 58 58 67190, Fax: +41 58 58 67383, Mobile: +41 79 438 96 30, rainer.sinkwitz@ch.abb.com