0

How to achieve Comboitem word-wrap in a Combobox?

asked 2010-04-22 05:45:51 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

updated 2010-04-22 05:46:06 +0800

We need to have word-wrapped comboitems in a Combobox.

Code to reproduce:

<zk>
	<style>
		.z-combobox-rounded-pp, .z-bandbox-rounded-pp,
		.z-datebox-rounded-pp, .z-combobox-pp, .z-bandbox-pp,
		.z-datebox-pp { max-width:157px;}
	</style>
	<window border="normal">
		<combobox>
			<comboitem
				label="A Very Long Text Which Should Be Broken Into Multiple Lines For Readability!"
				sclass="word-wrap" />
			<comboitem label="Item2" sclass="word-wrap" />
			<comboitem label="Item3" sclass="word-wrap" />
			<comboitem label="Item4" sclass="word-wrap" />
			<comboitem label="Item5" sclass="word-wrap" />
		</combobox>
	</window>
</zk>

We get horizontal scrollbar to view the first item as a whole.
But, we are looking a way to wrap the comboitems, hence no need of horizontal scrollbar.

Any help will be appreciated.

Thank you.

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2010-04-27 01:56:48 +0800

samchuang gravatar image samchuang
4084 4

Hi

you could use setCotent, to set html directly

link publish delete flag offensive edit

answered 2010-05-03 02:07:37 +0800

baskaraninfo gravatar image baskaraninfo
526 2 2 9

Thank you, Samchuang :)

I have achieved as follows:

<zk>
<style>
-combobox-rounded-pp .z-comboitem-text, .z-combobox-rounded-pp
		.z-comboitem-btn, .z-combobox-pp .z-comboitem-text,
		.z-combobox-pp .z-comboitem-btn {
		width:173px;word-wrap:break-word;
		max-width:120px;white-space:pre-line;}
</style>
	<combobox width="185px">
		<comboitem label="Simple and Rich" />
		<comboitem label="The Long Line Which needs to break to Multi-Line!" />
		<comboitem label="Thumbs Up!" />
	</combobox>
</zk>

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2010-04-22 05:45:51 +0800

Seen: 1,427 times

Last updated: May 03 '10

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More