2 Replies Latest reply on Sep 24, 2010 10:46 AM by Satya K

    How to get selected row from dataTable

    Satya K Newbie

       

      Hi All,

       

      I needed to get the selected row from a rich:dataTable .

       

      I found many suggestions from previous posts and implemented one, but that is  not working.

       

      Here is the discussion which I referred : http://community.jboss.org/message/21533#21533

       

      And my code :

       

      <rich:dataTable id="idChannelsExtTable"
                      value="#{channelsBean.channelsList}"
                      binding="#{channelsBean.dataTable}"
                      var="channelAttr" sortMode="single">

       

           <rich:column sortable="false" label="Generation Parameters">

             <f:facet name="header">

                <h:outputText value="Generation Parameters" />
               </f:facet>
               <h:outputText value="#{channelAttr.generationParameters}" />
           </rich:column>

                -

                -

                -

      <a4j:support event="onRowDblClick" requestDelay="400" actionListener="#{channelsBean.editDataItem}" ajaxSingle="true" />

      </rich:dataTable>

       

      and backing bean as :

       

      private UIDataTable dataTable;

      public void editDataItem(ActionEvent event) {
              log.info("selected row index : " + getDataTable().getRowIndex());
          }

       

      PS: Backing bean is session scoped.

       

      Also the whole flow is : I have a rich:comboBox which retrieves the data for above said rich:dataTable.

      When I double click on a row, method to retrieve dataTable is called but not the method which intends to capture clicked row index i.e editDataItem.

       

      Regards,

      Satya