3 Replies Latest reply on Nov 13, 2008 9:17 AM by Stefan Anderssson

    a4j:repeat

    Daniel Margreth Newbie

      hey everyone,
      i've been trying to use the repeat component to get the index of the clicked row, but i keep getting -1 when i call getRowIndex() on the UIRepeat object. this happens indendently of which row i click. the row count obtained via the getRowCount() method is correct and also when i print the row numbers on the website they seem correct.

      here is the xhtml code:

      <?xml version="1.0" encoding="UTF-8"?>
      <!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:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich">
      
      <body>
      
      <ui:composition>
      
       <h:form>
       <a4j:keepAlive beanName="finanzflussBean" />
      
       <a4j:repeat value="#{finanzflussBean.finanzfluesse}" var="item"
       binding="#{finanzflussBean.repeater}">
       <a4j:outputPanel styleClass="af_box">
       <h:outputText value="TEST" />
       <a4j:support event="onclick"
       action="#{finanzflussBean.expandFinanzfluss}" />
       </a4j:outputPanel>
       </a4j:repeat>
      
       </h:form>
      
      </ui:composition>
      
      </body>
      </html>


      and here the code fragment from the BackingBean:

      public String expandFinanzfluss() {
       int rowKey = this.getRepeater().getRowIndex();
      
      
       return null;
       }