6 Replies Latest reply on Feb 4, 2008 6:06 PM by aish

    row selection in rich:dataTable

    abcd1

      hiii everyone

      is it possible to select a row in dataTable like we do in rich:scrollableDataTable

      is their any selection attribute or SimpleSelection in backend bean to get the selected row.

      thanks in advance
      cheers.

        • 1. Re: row selection in rich:dataTable
          abcd1

          can anyone provide any link to a tutorial, showing row selection in dataTable

          • 2. Re: row selection in rich:dataTable
            mail.micke

            If you use binding for the datatable you should be able to get the selected row from the component.
            In the Richfaces docs there is some code showing which class the datatable component is.

            • 3. Re: row selection in rich:dataTable

              There are two ways I have gone about it. One way is to use binding attribute with property on bean being UIData. From there you can get the rowIndex or selected row. The other way is to use the rowkey if you are using a rich:dataTable along with actionparam to pass the selectedRow based on a action in the table. Kind of depends on the type of components in the cell, inputs versus text.

              <rich:dataTable binding="#{table.dataModel}" rowkey="#{rowkey}">
              <rich:column>
              <a4j:commandLink action="#{someaction}">
              <a4j:actionparam name="selectedRow" value="#{rowkey}"/>
              </a4j:commandLink>
              </rich:column>
              </rich:dataTable>

              • 4. Re: row selection in rich:dataTable
                aish

                Thanks for the information. I tried the logic and encountered some problem with it. Please correct me if my understanding is not correct.

                There is no "onRowClick" attribute in datatable to select the row where as we have this attribute in scrollabledatatable. Without this, is it possible to select a row from the datatable.

                Thanks in advance for your clarification.

                Aish

                • 5. Re: row selection in rich:dataTable
                  aish

                  Please ignore my previous note.. It was my mistake that I overlooked dataList component instead of dataTable. I do see onRowClick in dataTable.

                  Thanks
                  Aish

                  • 6. Re: row selection in rich:dataTable
                    aish

                    Please ignore my previous note.. It was my mistake that I overlooked dataList component instead of dataTable. I do see onRowClick in dataTable.

                    Thanks
                    Aish