2 Replies Latest reply on Dec 9, 2008 5:08 AM by Ilya Shaikovsky

    HtmlScrollableDataTable selected row index

    Jignesh Dhua Newbie

      Hi
      I have problem to get selected row index from HtmlScrollableDataTable
      it gives -1 when i am trying to fetch so please help me out
      and if it can possible then give me one example in which you can fetch the seleted row index

      Thanks in advance

        • 1. Re: HtmlScrollableDataTable selected row index
          Jignesh Dhua Newbie

          I used <a4j:support event="onRowClick" actionListener="bean.select"> for ScrollableDataTable..

          When i'm selection perticular row everything is going perfect, and bean.select(ActionEvent event) method called. Also i get data from dataTable.getRowData() method.

          Now I want index of selected Row.. How i can get it?

          I try dataTable.getRowIndex(), but it always returns -1..

          Any Solution? Is there any other way to get row on select event of Row?

          regards,

          Jignesh Dhua

          • 2. Re: HtmlScrollableDataTable selected row index
            Ilya Shaikovsky Master

            This code used to get selection in our richfaces-demo ;)

             public String takeSelection() {
             getSelectedCars().clear();
             if (getSelection().isSelectAll()){
             getSelectedCars().addAll(allCars);
             }else{
             Iterator<Object> iterator = getSelection().getKeys();
             while (iterator.hasNext()){
             Object key = iterator.next();
             table.setRowKey(key);
             if (table.isRowAvailable()) {
             getSelectedCars().add((DemoInventoryItem) table.getRowData());
             }
             }
             }
             return null;
             }