1 Reply Latest reply on Oct 6, 2008 5:46 AM by andrei_exadel

    rich:columns not working

    deepaksawdekar

      Hi,

      I am trying to use the rich:columns to print variable number of columns. I tried a simple protype as below but nothing is getting rendered. I am using richfaces 3.2.0. SR1-GA.

      My back bean is
      package com.model;

      import java.util.ArrayList;
      import java.util.List;

      import javax.interceptor.Interceptors;

      import org.hibernate.search.annotations.Factory;
      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.annotations.Scope;
      import org.jboss.seam.annotations.datamodel.DataModel;

      import com.sun.xml.internal.ws.developer.Stateful;

      @Stateful
      @Name("backBean")
      @Interceptors({org.jboss.seam.ejb.SeamInterceptor.class})
      public class BackBean {

      @DataModel
      private List myList;

      public void BackBean(){
      System.out.println("inside my list");
      List myList=new ArrayList ( ) ;
      myList.add ("1") ;
      myList.add ("2") ;
      System.out.println ( "string array to list"+myList ) ;
      }

      }

      editreason.page.xml

      <?xml version="1.0" encoding="UTF-8" ?>
      <page xmlns="http://jboss.com/products/seam/pages" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">




      editreason.xhtml
      <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <ui:composition xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:s="http://jboss.com/products/seam/taglib"
      xmlns:c="http://java.sun.com/jsp/jstl/core"

      >

      <h:form>
      <rich:dataTable width="483"id="reasonListTable" rows="7" columnClasses="col"
      value="#{backBean.myList}" var="backBean" summary="Reason List" >

      <h:columns value="#{myList}" var="i" index="ix">

      deepak2

      </h:columns>

      </rich:dataTable>



      </h:form>

      </ui:composition>



      Please let me know where am i missing.


      Regards
      Deepak

        • 1. Re: rich:columns not working

          Hi,

          The problem is in DataModel wrapper for 'myList'. Wrapper is creating after instance of class has been initialized.
          Class instance is creating after first value expression referenced to the bean name. It occurs in dataTable tag,

          But Columns requires the model early - during the tag creating phase.

          To solve the problem just remove DataModel wrapper, add setter/getters for 'myList' add use it as bean's property on the page.

          Anyway columns 3.2.0 version is not stable and contains many issues.
          Try the latest version for your purpose.