Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

richdata table and Row data  RSS feed

 
Raj Shekar H
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using rich data Table .. How to get the row data based on the radio button event .. I am completely stuck here

Thanks,
Rj
 
Greg Charles
Sheriff
Posts: 3014
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Interesting. I've often put check boxes in a rich:dataTable column, and I thought it would be basically the same thing. However, because of the way the JSF radio button component is implemented, it actually is a bit of thorny problem getting into a rich:dataTable. There's some discussion of the problem, and a proposed solution, in this old JavaWorld article
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, the cleanest solution for the case where you want a radio button to "select" a row is to use a checkbox plus CSS to provide alternate images (round buttons in "on" and "off" renderings). Then pair that with code to pop out previous buttons when a new button is selected.

Note that in JSF a radio button is not a boolean value, it's an enumeration-style value. That is, you don't have a collection of value slots, one per button, you have a single value slot whose value is set depending upon which button was selected. In no event should it be possible to select multiple radio buttons in a set at the same time or what you have isn't really a "radio button", regardless of what it looks like.

There are, incidentally, 2 ways to make a set of checkbox controls behave radiobutton-style. One is to do it client-side with javascript. This approach would seem most appealing, but javascript and HTML can be quirky about button-click and button-up/down events and has a nasty habit of getting out of sync with the Model (backing bean). I finally got fed up and these days I do it server-side by attaching an AJAX listener to the controls, updating the model itself and doing a refresh of the table containing the controls (since you cannot do per-column re-rendering).

Radio buttons, checkboxes and "click on this button/link" controls are all options with different meaning to the user, so be sure to select the approach that makes the most sense.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!