File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes f:selectItems h:selectOneMenu drop down menu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "f:selectItems h:selectOneMenu drop down menu" Watch "f:selectItems h:selectOneMenu drop down menu" New topic
Author

f:selectItems h:selectOneMenu drop down menu

Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
I am trying to give each option for a drop down menu a specific color, is there a way to do this:

I know the f:selectItems tag does not supply a style option. For some reason, it does not honor the coloring when I try to do this from a stored procedure.
It just displays as black text. Is there something I am missing with f:selectItems?

Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
Indeed, this isn´t supported by standard JSF components. Consider overriding the HtmlMenuRenderer to accept a f:attribute for the option classes.
You may find this article useful: http://balusc.blogspot.com/2008/08/styling-options-in-hselectonemenu.html

That said, the HTML <font> tag is deprecated since 1998, you should be using CSS for styling.
Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
I tried to embed a span tag inside the option tag and this does not appear to be working either. I would think this would work. Can you think of any CSS to JSF reasons why this would not work.


Bauke Scholtz wrote:Indeed, this isn´t supported by standard JSF components. Consider overriding the HtmlMenuRenderer to accept a f:attribute for the option classes.
You may find this article useful: http://balusc.blogspot.com/2008/08/styling-options-in-hselectonemenu.html

That said, the HTML <font> tag is deprecated since 1998, you should be using CSS for styling.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
(...)
Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
does that mean you dont know or that I should elaborate?

Bauke Scholtz wrote:(...)
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
I was just speechless.
Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
Do you thnik a span inside an option tag should work....

Bauke Scholtz wrote:I was just speechless.
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
You completely ignored my reply with the solution in it.

It's fine if you have a big plate up front, but please don't expose it here as well. It's a waste of time and effort.
Anthony Sykes
Ranch Hand

Joined: Aug 25, 2007
Posts: 57
I did not ignore your reply I was just trying to look for another option before trying it. It seemed as if the span idea would have worked as a quick alternative. I am under the gun on this project and hit a roadblock with this problem.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: f:selectItems h:selectOneMenu drop down menu