• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to wrap text in the option list of select tag using JSF  RSS feed

 
David samueal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Can anyone please give me an idea to wrap the option tag text in the select tag using jsf?? since the longer text in the option list is being CUT OFF

Is there any predefined function available (My luck!!)

Or we need to do that manually!!

because, increasing the width of the select tag is not a good approach as it is increasing my application width size.

Earlier response is much appreciated.

Thanks,
D@ve
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Early responses are more often received by people who don't post the same question in multiple forums and who Use Real Names.

I know the answer (you aren't going to like it). But you're going to have to play by the rules before I give it out.
 
David samueal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Holloway wrote:Early responses are more often received by people who don't post the same question in multiple forums and who Use Real Names.

I know the answer (you aren't going to like it). But you're going to have to play by the rules before I give it out.


Can you tell me the answer??
 
Sebastien David
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim,

What's the solution you're proposing ?
I am facing the same problem and, in my mind, there is no solution working only with the h:selectOneMenu component. I tried to insert some \n and \r chars in the option tag text, but it's not working.

I think we have to write some javascript in addition of div component to display the result as we want.

Thanks in advance !

Sebastien.
 
Tim Holloway
Bartender
Posts: 18662
71
Android Eclipse IDE Linux
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As I said originally, he wouldn't like it.

The selectOneMenu control renders as an HTML SELECT control. The HTML select supports a dropdown list of options, where each option appears in a fixed-height cell, one text row high. No wrapped text. Although specs indicate that the HTML OPTION element can have styles applied to it, no browser I know of supports that.

So the solution is to fake a select control where the dropdown list is a table or tabular element. Building the functionality up from scratch the hard way so that you can get the extra features that you need.

You might be able to find an extension tagset that has such a control already. If not and you are using RichFaces, you can take advantage of the fact that RichFaces internally includes jQuery to make the JavaScript programming easier. Some of the other third-party tagsets may have similar advantages, although I haven't taken an inventory.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!