This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have drop down list which lists n number of products. When a product name is huge my drop down list gets long. Is there a way to restrict the max length of the text to be displayed, and display ... after the length. Please advice me on this.
Ananth, Do you want to restrict the length (have less than n elements in the list) or the width (have n elements but display less text for the long ones) ?
If length, you can put less entries in the list in Java. If width, you can use a CSS style to set the width of the pull down to an explicit number or pixels. Alternatively for width, you can loop through in Java, and get rid of some of the characters.
These are both technical solutions. A "better" solution would be to edit the source data to make it shorter or make a "display name" equivalent that is shorter. Sometimes chopping off data doesn't yield the best results unless a human does it.
Hi,If its the width you want to restrict,you can use a a CSS or otherwise (as stated in the solution above)to restrict the width.Tool tip can be used so that user can see the full terxt if it is not completely visible