• Post Reply Bookmark Topic Watch Topic
  • New Topic

scroll bar in <h:selectOneMenu>  RSS feed

 
Vimal Kumar Venugopal
Ranch Hand
Posts: 43
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy Ranchers,

I tried in vain to bring about scroll bar in <h:selectOneMenu>. But its not showing up.
I am populating values from a DB through <h:selectItems> child tag. Since there are more than 20 values being fetched from the DB, it is causing the dropdown drop 'down' till the end of the page.

If we cant have a scroll bar in selectOneMenu then what is the workaround?

Rangers, please help me out on this.

Ron.
 
Tim Holloway
Bartender
Posts: 18775
74
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are limited here by the characteristics of the HTML SELECT control, which is in turn defined by the user's browser and OS. A common implementation of this control would put a flat triangle (arrow) at the bottom of the dropdown box for scrolling. Or at the top, as needed. An actual scrollbar is less common.

Speaking as a user, I find any dropdown list with 20 or more elements in it to be awkward, so I recommend meditating on whether this is the optimal way to present your selections.

If you want to ensure an actual scroll bar, you could simply do it the hard way: wrap the list up as a table in a scrollable pop-up div and attach logic/css for highlighting and selection as needed.
 
Vimal Kumar Venugopal
Ranch Hand
Posts: 43
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your reply Tom.. You surely did hit the nail..!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!