Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Get the selected row in datatable [PRIMEFACES]  RSS feed

Andre Froes
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.

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