Growing listbox when closing a group

asked 2009-04-02 11:27:22 +0800

Rico gravatar image Rico
175 1 1 2


Just started to use a listbox with groups (grouping) for real and while it generally works just fine, the listbox grows horizontally when closing the groups.

My listbox is set to a fixed height using the rows attribute, and initially all groups are open (as is the default implementation I think), and the listbox is in one size, but when I close a group, the lisbox gets higher, and the more groups I close, the higher it gets.

Am I doing something wrong here? I also do have an itemRenderer attached to the listbox for rendering the items, but no special handling of the various items is done...

Here is part of the code I use:

<listbox id="my_listbox" rows="15" width="300px"
   model="${groupmodel}" itemRenderer="${groupmodel}">
      <listheader label="Name" />


delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2009-04-02 14:03:27 +0800

hideokidd gravatar image hideokidd
750 1 2

updated 2009-04-02 14:05:48 +0800


Model and itemRenderer of a listbox should not be the same, there are two examples about rowrenderer, which is similar to itemrenderer




link publish delete flag offensive edit

answered 2009-04-03 06:25:41 +0800

Rico gravatar image Rico
175 1 1 2

updated 2009-04-03 06:29:06 +0800


Thanks for You reply, but the itemRenderer doesn't seem to be the issue here since the problem remains even if I omit the itemRenderer and use the default item renderer.

As an explanation to Your comment on model/itemRenderer being the same - In this case, the class used as model for the listbox implements the ListitemRenderer as well as extending the SimpleGroupsModel, and then there shouldn't be any problem using the same class for both model and renderer, right?

Sorry for not being clear on this. I use this quite often when implementing custom model/rendering for listboxes since there are often things known by the model that might come handy when rendering. And it have never been a problem with "ordinary" listboxes...

Regardless of this, as I said before, removing the itemRenderer still yields the same result of the listbox changing height when closing/opening groups. I could take a small change in size, but if a group contains a lot of listitems, the change in size is quite big (apparently the size change is somewhat proportional to the number of items in the group, i.e. the "height" of the group).


link publish delete flag offensive edit

answered 2009-04-03 11:21:47 +0800

hideokidd gravatar image hideokidd
750 1 2


Thanks for information,
but I cannot "guess" what's wrong,
maybe that's a bug.

If possible,
please give more hints(runnable code is appreciated)


link publish delete flag offensive edit

answered 2009-04-03 11:51:04 +0800

Rico gravatar image Rico
175 1 1 2


The problem seems to be that when using "rows" to define the height of a listbox it gives this behavour. Setting the size to a fixed number of pixels keeps the height of the listbox even if I open/close the groups.

I have seen the same issue with standard listboxes when using "rows" to set the height. The height changes depending on the what's in the listbox. If you have an empty listbox and then adds an item or so to it, the size is changed a couple of pixels. In the case of groups the size changed much more, making it a bit harder to use.

Again, thanks for the effort of helping out...


link publish delete flag offensive edit

answered 2009-04-09 04:34:15 +0800

hideokidd gravatar image hideokidd
750 1 2

updated 2009-04-09 04:39:39 +0800


Sorry for replying late, I've downloaded demo code from
and tried, the case you mentioned occurred.

I think that's a bug when ZK evaluates the height of listbox,
if I set rows=10,
ZK will evalute total height of 10 rows(here the rows include listgroup),
if the height of listgroup is different from other row,
The evaluation would be incorrent.

Anyway, that's a bug for this case, please report to ZK bug,

Of course a workaround is to set fixed height instead of rows,
though that doesn't make sense......

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: 2009-04-02 11:27:22 +0800

Seen: 436 times

Last updated: Apr 09 '09

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