2

How can i get the selected rows bean.id from h:dataTable in a backing bean? f:ajax with f:param inside h:column didn't work for me. Any suggestions (not using h:commandLink since i want the row to be chosen anywhere)?

Benchik
  • 2,057
  • 5
  • 26
  • 44
  • Duplicate of [h:commandButton can NOT submit parameters to backing bean](http://stackoverflow.com/questions/3711351/hcommandbutton-can-not-submit-parameters-to-backing-bean) – BalusC Jan 23 '11 at 22:38
  • 1
    Not exactly a duplicate since i don't want to use a commandLink/commandButton but click the row anywhere. – Benchik Jan 24 '11 at 05:19
  • 2
    @BalusC asking you here to avoid a duplicate but can ask as a new question if you want.Is there no way to make whole table row clickable\selectable like richfaces allows not just the text. I mean just allow click any where on the row using just JSF2. – Java Ka Baby Oct 05 '11 at 06:22

1 Answers1

1

Actually BalusC's comment is good enough, although i added a small improvement, so that h:commandLink will look like a h:outputText and that it will occupy the whole table cell so that you get the effect of clicking the cell anywhere (not only the text). So what i did is adding a small CSS:

table tr td a {
    display: block;
    padding: 5px 0px 2px 4px;
    text-decoration: none;
    color: #000000;
    width: 160px;
}
Benchik
  • 2,057
  • 5
  • 26
  • 44