• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How know which row was selected in the datatable

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
<h:outputText styleClass="tablaitem" value="EMISORA"></h:outputText>
</f:facet>
<h:commandLink target="_blank" id="emisora" action="#liquidacionPorDecretosHandler.consultarListaDecretosDetalle}">
<h:outputText value="#decretos.emisora}">
</h:outputText>
</h:commandLink>
</h:column>
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Saloon Keeper
Posts: 25608
183
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Very good! thanks a lot, I can obtain the selected row, I�m grateful for your help.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic