0

How to limit the number of Comboitems displayed at any time?

asked 2010-04-22 06:03:21 +0800

baskaraninfo gravatar image baskaraninfo
536 2 2 9

We have a combobox and it has some 100 comboitems.

When we select the drop-down button, it initially displays 19 items, for remaining we need to use vertical scroll-bar to navigate and view accordingly.

But, we need to limit the drop-down have only 10 items initially, instead of 19.

Any help is appreciated.

Thank you.

Code to Reproduce:

<zk>
	<window border="normal">
		<combobox>
			<comboitem label="Item1" 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" />
			<comboitem label="Item6" sclass="word-wrap" />
			<comboitem label="Item7" sclass="word-wrap" />
			<comboitem label="Item8" sclass="word-wrap" />
			<comboitem label="Item9" sclass="word-wrap" />
			<comboitem label="Item10" sclass="word-wrap" />
			<comboitem label="Item11" sclass="word-wrap" />
			<comboitem label="Item12" sclass="word-wrap" />
			<comboitem label="Item13" sclass="word-wrap" />
			<comboitem label="Item14" sclass="word-wrap" />
			<comboitem label="Item15" sclass="word-wrap" />
			<comboitem label="Item16" sclass="word-wrap" />
			<comboitem label="Item17" sclass="word-wrap" />
			<comboitem label="Item18" sclass="word-wrap" />
			<comboitem label="Item19" sclass="word-wrap" />
			<comboitem label="Item20" sclass="word-wrap" />
			<comboitem label="Item21" sclass="word-wrap" />
			<comboitem label="Item22" sclass="word-wrap" />
			<comboitem label="Item23" sclass="word-wrap" />
			<comboitem label="Item24" sclass="word-wrap" />
			<comboitem label="Item25" sclass="word-wrap" />
			<comboitem label="Item26" sclass="word-wrap" />
			<comboitem label="Item27" sclass="word-wrap" />
			<comboitem label="Item28" sclass="word-wrap" />
		</combobox>
	</window>
</zk>

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2010-04-22 20:27:31 +0800

ashishd gravatar image ashishd flag of Taiwan
1972 6

Hi baskaraninfo,
I'm not sure about this but take a look at this thread and this smalltalk from Jumper to get some idea on using ListModel.getSubModel(). Let me know if that doesn't solve your problem.

Thanks
- Ashish

link publish delete flag offensive edit

answered 2010-04-26 01:00:07 +0800

baskaraninfo gravatar image baskaraninfo
536 2 2 9

updated 2010-05-19 01:13:05 +0800

Thank you Ashish for your reply.

Its different thing. If we use SimpleListModel, at any time, we will have only the limited rows displayed irrespective of its actual items. To change it, we need to extend and write our own custom class.

I don't want to limit the comboitems loading in Combobox. I just want to reduce the combobox popup items initially shown on drop-down list with vertical scroll bar as-need-basis.

I have achieved a work-around by setting height to combobox drop-down height.

link publish delete flag offensive edit

answered 2011-06-12 12:09:06 +0800

crsna gravatar image crsna
30

@baskaraninfo can you tell me how you set height to combobox drop-down height.
thanks for your help

link publish delete flag offensive edit

answered 2011-06-12 13:26:03 +0800

TonyQ gravatar image TonyQ
642
https://www.masterbranch....

Reference to this thread and there's a temp work around.

http://www.zkoss.org/forum/listComment/16099

And you could test it here : http://zkfiddle.org/sample/3cjn7lt/1-A-workaround-for-setting-combobox-s-height

link publish delete flag offensive edit

answered 2011-06-12 13:28:36 +0800

TonyQ gravatar image TonyQ
642
https://www.masterbranch....

And there's a feature request for it, if you need it , please left your comment there ,
we will check if we could add it in future version.

http://sourceforge.net/tracker/?func=detail&aid=3300329&group_id=152762&atid=785194

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 06:03:21 +0800

Seen: 503 times

Last updated: Jun 12 '11

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