5 Replies Latest reply on Jun 4, 2007 12:56 PM by Yevgen Tester

    DataTable with controls (update state)

    Yevgen Tester Newbie


      i'm using richtfaces 3.0.0 (java 1.5, Tomcat 5.5)

      Trying to create an datatable with 1 row, 1 column (with HtmlInput).
      In future of course will be more rows and columns :)

      My jsp

       <rich:dataTable binding="#{jobsBean.table}"/ >
       <h:commandButton action="back" value="Submit" />

      My JobsBean
      public class JobsBean
       private HtmlDataTable table = null;
       private List list = null;
       public class TestClass
       String text;
       public String getText() { return text; }
       public void setText(String text) { this.text = text; }
       public JobsBean()
       this.list = new ArrayList();
       this.list.add(new TestClass());
       public HtmlDataTable getTable()
       return table;
       public void setTable(HtmlDataTable table)
       this.table = table;
       if (this.created == false)
       this.created = true;
       private void createTable()
       Application application = FacesContext.getCurrentInstance()
       this.table.setVar( "job" );
       ValueBinding vb = application.createValueBinding("#{job.text}");
       HtmlColumn column = (HtmlColumn) application
       HtmlInputText input = (HtmlInputText) application
       input.setValueBinding("value", vb);
       ValueBinding value = application.createValueBinding("#{jobsBean.list}");
       this.table.setValueBinding("value", value);
       public List getList() { return list; }
       public void setList(List list) { this.list = list; }

      And ... nothing happens. If i entered the text into the editor and press button ... the page refreshed but the editor is empty.

      Very interesting if i add the column and editor not from the bean, but simple in the jsp page, like
       <rich:dataTable binding="#{jobsBean.table}" var="job" >
       <h:inputText value="#{job.text}" />

      it works!
      There is the difference between adding dynamicly (from the bean) and static (jsp)