8 Replies Latest reply on Oct 14, 2007 5:45 AM by Pete Muir

    Binding HtmlDataTable to h:dataTable in Seam

    Arbi Sookazian Master

      Is it possible to do the following in Seam1.2.1.GA? I need a solution for a dataTable that can handle a dynamic column resultset from stored proc.

      snippet of .xhtml:

      <h:dataTable value="#{userRoleSearch.myList}" var="myItem" binding="#{userRoleSearch.dynamicDataTable}"/>


      snippet of userRoleSearch SFSB:
      public HtmlDataTable getDynamicDataTable() {
       if (dynamicDataTable == null) {
       viewRolesData(selectedChoices);
       populateDynamicDataTable();
       }
      
       return dynamicDataTable;
       }



      The @DataModel Seam annotation exposes an attribute of type java.util.List to a JSF page as an instance of javax.faces.model.DataModel. The <h:dataTable> supports data binding to a collection of data objects represented by a DataModel instance.


      http://weblogs.java.net/blog/caroljmcdonald/archive/2007/07/sample_applicat_1.html

      In this case, I am not using @DataModel and the return type is HtmlDataTable which dynamically replaces the <h:dataTable> rendering based on the # of columns in the resultset.

      The solution above works fine with JSF + managed bean, but it doesn't work with Seam (I get JSF h:dataTable tag formatting error).

      Will I need to use a hybrid Seam SFSB + managed bean approach?? thx.