File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes Get the selected row in datatable [PRIMEFACES] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Get the selected row in datatable [PRIMEFACES]" Watch "Get the selected row in datatable [PRIMEFACES]" New topic

Get the selected row in datatable [PRIMEFACES]

Andre Froes

Joined: Oct 13, 2010
Posts: 18
Hey guys, i'm not managing to get the selected row from my datatable. I tried to do like the example in the showcase (link here) but I may be missing some tiny detail.

Here's the xhtml:

Here's the code from my bean:

in my onRowSelect I ask it to show me the attribute numOs from the current selected row in the dialog, but nothing is shown.
in the console nothing appears either, not even a null value. I debugged the project, but couldn't discovery anything as well.

I appreciate any help, thanks a lot
Brendan Healey
Ranch Hand

Joined: May 12, 2009
Posts: 218

Firstly I think you're trying to do too much in one go. Unfortunately it never works with this
infrastructure and is difficult to debug.

Having said that you want to be using view scoped beans with primefaces. Request scoped
beans don't work well with ajax, and most primefaces components are ajax enabled by
default. Are your imports correct? if, for example, you've imported
javax.annoation.ManagedBean then unless you're intentionally using CDI, you've got the
wrong package, but it's not apparent because you've not included the imports in your post.

I would suggest getting rid of the code for the dialog temporarily as dialogs are tricky so
remove onRowSelectComplete. Use <ui:remove> </ui:remove> to take out all but one of
the columns and see if that helps.

Are there any javascript errors on the page? (in internet explorer, depending on settings,
a yellow ! warning icon on bottom left of screen), or anything in the server log.

I agree. Here's the link:
subject: Get the selected row in datatable [PRIMEFACES]
It's not a secret anymore!