8 Replies Latest reply on May 20, 2011 5:06 AM by devilqp

    IllegalArgument get RowData and rowIndex -1

    devilqp

      Hi guys,

      I have a problem with the tag rich:dataTable where in it has value as a column that has an EL expression on my pageCode with a methodthat calls the method 'getRowData()' of 'HtmlDataTable'.

       

      I have a list of 8 items, but in the method 'getQuotaCapitale ()' lifecycle enter 10 times by having a

      'rowIndex = -1' and therefore an IllegalArgumentException because the row is not available.

      Why do this?

      I printed in console the variable rowIndex and rights cycled from 0 to 7, but falls in method 2 more times to no avail.

      Please help me, I don't know what else to do.

      Thanks.

       

      P.S: i used richfaces 3.1.6 GA under webspheare application server 6.1 and jsf 1.1

       

      The code below will explain the problem better:

       

      test.xhtml

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html 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:a4j="http://richfaces.org/a4j"
            xmlns:rich="http://richfaces.org/rich">
      
      <h:form>
      <rich:dataTable id="dataTable" value="#{test.rateList}" var="rataVar" >
           <rich:column>
                <h:outputText value="#{test.quotaCapitale}" />
           </rich:column>
      </rich:dataTable>
      </h:form>
      </html>
      
      

       

       

      here Test.java (scope request)

      import org.richfaces.component.html.HtmlDataTable;
      
      public class Test extends PageCodeBase {
      
                private List<Long> rateList;
                private BigDecimal quotaCapitale;
      
                public List<Long> getRateList() {
                          if(rateList==null){
                          List<Long> longList = new ArrayList<Long>();
                          for (int i = 0; i < 8; i++) {
                                    longList.add(new Long(i));
                          }
                          rateList = longList;
                          }
                          return rateList;
                }
      
                public Long getQuotaCapitale(){
      
                                    HtmlDataTable dataTableRate = (HtmlDataTable)PageCodeBase.findComponentInRoot("dataTable");
                                    Long rata = (Long)dataTableRate.getRowData();
                                    return rata;
      
                          }
      }