Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

f:selectItems h:selectOneMenu drop down menu

 
Anthony Sykes
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(...)
 
Anthony Sykes
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
does that mean you dont know or that I should elaborate?

Bauke Scholtz wrote:(...)
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just speechless.
 
Anthony Sykes
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you thnik a span inside an option tag should work....

Bauke Scholtz wrote:I was just speechless.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic