• Post Reply Bookmark Topic Watch Topic
  • New Topic

How know which row was selected in the datatable  RSS feed

 
Chelis Flores
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I new in JSF, I want to know how to do to obtain the row was selected in a datatable, I show a List in the datatable, in the datatable there are several columns and commandlink, in this, I send another action, but how can I do for obtain the row was selected
this is my code,thanks, and sorry for the writting I know english a little bit.

<h:column>
<f:facet name="header">
<hutputText styleClass="tablaitem" value="EMISORA"></hutputText>
</f:facet>
<h:commandLink target="_blank" id="emisora" action="#liquidacionPorDecretosHandler.consultarListaDecretosDetalle}">
<hutputText value="#decretos.emisora}">
</hutputText>
</h:commandLink>
</h:column>
 
Ben Zahler
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in the <h:dataTable> tag, you should have defined an attribut "var". The bean associated with the selected row is stored in the request with this name.

In my case, the name is " varrecords", thus I get the bean with

this.getRequestScope.get("varrecords")

hope this helps!
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The DataTable control required a model data wrapper, so if you write an action processor, you can query the data wrapper:



I like to end the names of my action processors with "Action" so that it's more obvious that they're actions and not properties. JSF doesn't care, but it makes my life simpler.
 
Chelis Flores
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very good! thanks a lot, I can obtain the selected row, I�m grateful for your help.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!