1 Reply Latest reply on Oct 4, 2012 2:29 PM by Mahesh Bonagiri

    Datatable: Cant get row index

    K Jav Newbie

      Hi all, im currently working on datatable displaying a list of user. So far everything is working fine including sorting and filtering of the list. The problem now is I need to get a particular row index when selecting a row. I understand that rowKeyVar wont work when table is dealing with sorting/filtering, the solution to it that I find online is by using iterationStatusVar. I followed the example from RichFaces showcase http://showcase.richfaces.org/richfaces/component-sample.jsf?demo=dataTable&sample=dataTableEdit&skin=blueSky and also from Practical RichFaces 2nd Edition but my row index always return 0 when I click on any rows. Here's my part of current codes:


      <rich:dataTable value="#{userManagedBean.users}" var="user"


      style="height:100px; width:650px;"

      iterationStatusVar="it" rows="10">



      <f:facet name="header">Action</f:facet>

      <a4j:commandLink execute="@this" render="@none">

      <rich:componentControl target="confirmPane" operation="show" />

      <h:graphicImage value="/resources/images/common/user_delete.png" />

      <a4j:param value="#{it.index+1}" assignTo="#{userManagedBean.currentUserRow}" />




      And in my userManagedBean class



      public class UserManagedBean {


      private int currentUserRow;


      public int getCurrentUserRow() {

          return currentUserRow;




      public void setCurrentUserRow(int currentUserRow) {

          this.currentUserRow = currentUserRow;