4 Replies Latest reply on Apr 26, 2009 11:00 PM by nimo22

    #{index} of datatable

    nimo22

      How can I obtain the actual index of a row in a datatable?

      something like?

      <rich:extendedDataTable rowKeyVar="#{index}" .../>
      
      <rich:column >
      #{index}
      </rich:column>
      
      </rich:extendedDataTable>



        • 1. Re: #{index} of datatable
          ilya_shaikovsky

          yes this code should works.

          • 2. Re: #{index} of datatable
            nimo22

            it does not work and I do not know why (RF 3.3.0).

            However {index} is not a defined property in my managed bean, but I guess, this is not the problem?!

            <rich:dataTable value="#{viewDatas}" var="_a" rowKeyVar="#{index}" >
            
             <rich:column label="index">
             <f:facet name="header">
             <h:outputText value="Index"/>
             </f:facet>
             <h:outputText value ="#{index}"/>
             </rich:column>
            
             </rich:dataTable>


            • 3. Re: #{index} of datatable
              nimo22

              I tried it also with that:

              <a4j:repeat value="#{myDatas}" var="d" rowKeyVar="#{index}">
              
               <h:outputText value="#{d.prop} #{index}"/>
              
               </a4j:repeat>


              it does not work, strange.

              • 4. Re: #{index} of datatable
                nimo22

                oh was my fault. this works:

                <a4j:repeat value="#{myDatas}" var="d" rowKeyVar="i">
                #{i}
                </a4j:repeat>