• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to fetch a row from a datatable?

 
silson varghese
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsf datatable which has 8 columns. I need to fetch a row completely when the check box corresponding to that row is checked. In the backing bean an object corresponding to a row is created. How can I get the object ID of the row which is checked ?

Appreciate your help for the same.
 
Darryl Nortje
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there Silson,

There are a couple of ways of doing this. Here is one.

In your dataTable component on your page, bind it to an HtmlDataTable attribute of your Bean. Then when the user selects a row, fire an action event by way of a commanLink or button. And in your bean ask the HtmlDataTable which row by calling HtmlDataTable.getRowData(). This will the return an instance of the row that was clicked.

cheers
Darryl
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!