Get heigh of component

asked 2010-03-04 07:31:33 +0800

orism gravatar image orism
24 1 3

I got some problems by getting the height of a component.

The component is a listbox with vflex="1".
My target is now to calculate the amount of listitem's that i can display within this listbox without scrolling.

In order to do that i will need the current height of the listbox .

Is there any event I can register in order to get the height of the component.

The only size event i get working is the ClientInfoEvent, this delivers only the total desktop heigth. But if i got nested elements this is not really good.

Is there any solution for this?

Thanks in advance.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2010-03-07 19:44:38 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi, orism
If you don't want to display the listbox without scrolling.

you can try this sample

		String[] data = new String[5];
		for (int j = 0; j < data.length; ++j) {
			data = "option " + j;
		ListModel strset = new ListModelList(data);
		void change(int num) {
			String[] data = new String;
			for (int j = 0; j < data.length; ++j) {
				data = "option " + j;
			listbox.setModel(new ListModelList(data));
	<button label='10' onClick='change(10)' />
	<button label='20' onClick='change(20)' />
	<button label='30' onClick='change(30)' />
	<listbox id="listbox" width="200px" model="${strset}">
			<listheader label="Load on demend" />

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




Asked: 2010-03-04 07:31:33 +0800

Seen: 258 times

Last updated: Mar 07 '10

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