How to get layout like the following using h:selectOneRadio encapsulated within a rich:dataTable
row1 col1 col2 col3
row2 radio1 radio1 radio1
row3 radio2 radio2 radio2
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think there are three ways of doing that:
Use the Tomahawk
<t:selectOneRadio>and<t:radio>components, as described by Bozho. This is the simplest solution. The only drawback is that you have to integrate another components library in your project (Tomahawk). However, this library is compatible with others libraries, like Richfaces or Icefaces.Create your own component for that. This is more complex than the previous solution, and may not be really interesting as the
Tomahawklibrary is already providing this component…Use the “basic”
<h:selectOneRadio/>component and then useJavascriptcode to move the radio elements where you want. In my project, I had a popup that contains a list of checkboxes, but I wanted to display all of them in two columns. Unfortunately, the<h:selectManyCheckbox>component only provides thepageDirectionandlineDirectionlayouts. So I decided to display them using thepageDirectionlayout, and then manipulate the generated HTML code to break the list into two parts, using Javascript.So here is what I did on the JSF code:
and the Javascript function (using
jQuery, which is bundled inRichfaceslibrary):(more explanations about this code here)
In your case, the Javascript function will be harder to write, as you want to move the radio buttons within a table generated by a
<rich:datatable>.