2 Replies Latest reply on Oct 13, 2011 2:24 AM by Sathya Chandrasekaran

    how to use iterationStatusVar in datatable

    Sathya Chandrasekaran Newbie

      Do we need to do anything in managed bean apart from mentioning iterationstatus var in xhtml page for using them? .Because Im using it same as the example given in richfaces demo. but the numbers are not coming, at the same time its not throwing any error ?

       

      Need help. thank you

        • 1. Re: how to use iterationStatusVar in datatable
          iabughosh Master

          Dear Sathya,

           

          you need to execute the table to send the current index to your bean, EX :

          <rich:dataTable id="userSearchTable"

                                 value="#{yourList}"

                                 var="row"

                                 iterationStatusVar="status">

          <h:column>

          <f:facet name="header">

               <h:outputText value="header"/>

          </f:facet>

          <a4j:commandLink id="userDeleteLink"

                                      render="@none"

                                     execute="@this"

                                      action="#{yourBean.doSome(#{status.index})}">

          </a4j:commandLink>

           

          </h:column>

          </rich:dataTable>

           

          your java method :

           

          public void doSome(int rowIndex) {

               //etc

          }

           

          regards

          • 2. Re: how to use iterationStatusVar in datatable
            Sathya Chandrasekaran Newbie

            Thanks Ibrahim.

            I think I need to modify the question to explain what is wrong on my side.

             

            Inside datatable tag I used iterationStatusVar="it" and then

             

            my code is like this

             

            <f:facet name="header">

            <rich:columnGroup>

            <rich:column width="3%">#</rich:column>

            <rich:column  width="5%">

            <h:outputText value="Names" />

            </rich:column>

            </rich:columnGroup>

            </f:facet>

            <rich:columnGroup>

            <rich:column width="3%"> #{it.index}</rich:column>

            <rich:column  width="5%">

            <h:outputText value="#{bean.name}" />

            </rich:column>

            </rich:columnGroup>

             

             

             

            in the datatable rendered the rows under Names column is having values but the rows under # is empty.