Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

drop down list box height

 
Rajni Patel
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have created one drop down list box in jsp page using struts1.

There is 25 value in drop down list box. I don't want to make list too long. If it make small and then scrollbar will come in list.

could I set the height of list box? any suggestion?

Thanks in advance.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You cannot set the size of the opened drop-down, only the width of the unopened control.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I feel is if you have more records in the drop down which doesn’t fit in page then you convince the customer to compromise having it as selection popup (the best way).
however, you can still have dirty work arounds like playing with the visibility settings of div though..
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Shankar Tanikella wrote:however, you can still have dirty work arounds like playing with the visibility settings of div though..


HUH? What are you talking about? How does this apply to a select element?

Eric
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as i already mentioned dirty.. it is really dirty...

Anyways, what i fell is it is still to do something like below, didn’t try it though

For example, if i have 20 options, i shall iterate till 10 to show the recently used or something but only few in number, for now say 10 and the 11th option would be "...". All this setup would be in a div, and be visible on load on page
when user selects "..."
we shall block this and show another div with all elements (since user asked for it, it would be displayed)...

Doesn't this work?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It still has nothing at all to do with an HTML select element.

If the <select> element is unsuitable, it's certainly possible to create a custom widget using other HTML elements. In such a case I would not recommend anyone build their own, but rather use one of the existing widgets such as the jQuery UI Autocompleter widget.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Java Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect,
But i still go with a popup with radio button which is easier to implement (if the application is not rich in UI). If UI is rich then yes, to match with other screen elements JQuery is the best one. If Jquery is already in use then also Ok since there would be less learning to do. But only for this one select box? Moreover, its is Struts1 application, rich UI ??
 
Rajni Patel
Ranch Hand
Posts: 84
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not using jquery. could i set dropdown list box height with java script?

thanks,
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64182
83
IntelliJ IDE Java jQuery Mac Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, no. Nothing on Earth can change the drop-down height except rewriting the browser itself.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic