-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
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" onSelect="enableBtn();" model="${groupmodel}" itemRenderer="${groupmodel}"> <listhead> <listheader label="Name" /> </listhead> </listbox>
Hi,
Model and itemRenderer of a listbox should not be the same, there are two examples about rowrenderer, which is similar to itemrenderer
http://www.zkoss.org/smalltalks/livedata/livedataforgrid.dsp
http://en.wikibooks.org/wiki/ZK/How-Tos/Data-Binding
Thanks
Hi,
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).
Regards,
Rico
Hi,
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...
Regards,
Rico
Hi,
Sorry for replying late, I've downloaded demo code from
http://www.zkoss.org/smalltalks/grouping/
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,
http://sourceforge.net/tracker/?group_id=152762&atid=785191
Of course a workaround is to set fixed height instead of rows,
though that doesn't make sense......
Asked: 2009-04-02 11:27:22 +0800
Seen: 436 times
Last updated: Apr 09 '09