2 Replies Latest reply on Nov 28, 2007 5:00 AM by Terry

    How to access h:datatable row data during its iteration

    Terry Apprentice

      I want to access row data to do certain computation on some columns as the datatable iterates to populate itself. That computed value then will be displayed in table's footer.

      I also want to just access row index to list on the table.

      I tried datatable binding to to UIData in the backing bean but I get EntityManager is Null error?

      I think I can't use @DataModel for this purpose, since from what I read it works when user selects a row on table manually.

      
      @Name("paymentReconciliation")
      public class PaymentReconciliation extends EntityQuery {
      
      ...
      
      private UIData tableData = null;
      
      public UIData getTableData() {
      getTableData");
      return this.tableData;
      }
      
      public void setTableData(UIData uiData) {
      this.tableData = uiData;
      }
      
      ...
      
      }
      
      XHTML[\b]
      
       ...
       <h:dataTable id="paymentReconciliationList" var="paymentRecon" value="#{paymentReconciliation.resultList}"
       rendered="#{not empty paymentReconciliation.resultList}" border="1" binding="#{paymentReconciliation.tableData}">
      
       ...
      
       Exception
      11:51:55,077 ERROR [ExceptionFilter] exception root cause
      java.lang.IllegalStateException: entityManager is null
       at org.jboss.seam.framework.EntityQuery.validate(EntityQuery.java:31)
       at sun.reflect.GeneratedMethodAccessor542.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
       at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
       at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:32)
       at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
       at org.jboss.seam.interceptors.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
       at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
       at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
       at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
       at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
       at au.edu.tisc.session.admin.PaymentReconciliation_$$_javassist_97.validate(PaymentReconciliation_$$_javassist_9
      7.java)
      ...