Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Chaging the layout (pageDirection/lineDirection) of the HtmlSelectOneRadio

 
Silvester Stalin Bruno
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a jsf page, where i include radio buttons as shown below to display US states



As the number of states is "50", i cannot use the layout pageDirection/lineDirection. In either case, the page becomes extended.

Instead, i want to create a custom radion button component, in which i get the user input to show the buttons as a matrix (a x b), where a is number of rows
and b is numer of columns. So, i can display the US states as a 5 x 10 matrix. Here, US states is an example. I want to create a reusable component solving my problem.

What's the best way to create a custom component? I am a new bee to JSF.
1. Overriding HtmlSelectOneRadio (or)
2. Creating a new Custom component, overriding UIComponenBase - here i am not sure if i can include event listeners to the radio buttons.

Please advise.

Thanks in advance.
Stalin
 
Liangfeng Ren
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

MyFace does have a solution for this. Try to use its tomahawk tag <t:selectOneRadio> by setting layout property as "spread", then use <t:panelGrid> to layout the items.
Based on your requirement, the code can be as follows:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic