-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I have a listbox with groups where the model is created programmatically with this method:
private SimpleGroupsModel getModel(List<Thervariante> elements, String rollentyp, String rolle) { Thervariante[][] data = new Thervariante[elements.size()][1]; String[] heads = new String[elements.size()]; //Some code ... SimpleGroupsModel result = new SimpleGroupsModel(data, heads); return result; }
There is also a renderer used for this listbox:
public void render(Listitem item, Object data) throws Exception { Listcell lcMedikamente = new Listcell(); Listcell lcZuweisungen = new Listcell(); Listcell lcLeistungen = new Listcell(); Listcell lcDokumente = new Listcell(); Listcell lcEdit = new Listcell(); //Some code ... item.getChildren().add(lcZuweisungen); item.getChildren().add(lcLeistungen); item.getChildren().add(lcDokumente); item.getChildren().add(lcMedikamente); item.getChildren().add(lcEdit); if (item.getPreviousSibling() instanceof Listhead) { item.getListgroup().setOpen(true); } else { item.getListgroup().setOpen(false); } }
When the group is opened, the icon on the button for opening is closed and reversed. So the icon is showing the wrong state of the group. The first group is set to be opened and all the others are closed. Is it a bug or am I doing something wrong?
I wrote a short code for testing the issue
<zk> <window id="win" title="listbox" border="normal"/> <zscript> Listbox listbox = new Listbox(); Listgroup lg1 = new Listgroup(); Listitem lm1 = new Listitem(); Listgroup lg2 = new Listgroup(); Listitem lm2 = new Listitem(); public addListCell(Listitem lm){ for(int i=4; i!=0;i--){ lm.appendChild(new Listcell(""+i)); } } addListCell(lg1); listbox.appendChild(lg1); addListCell(lm1); listbox.appendChild(lm1); addListCell(lg2); listbox.appendChild(lg2); addListCell(lm2); listbox.appendChild(lm2); win.appendChild(listbox); lg1.setOpen(true); lg2.setOpen(false); </zscript> </zk>
I cannot make the problem reproducible ... could you provide further information
like runnable example and your version of zk & browser
I used zk 3.6.2 & firefox + ie7 for testing/
This problem occurs only when using an own model and an own renderer, so the whole logic is build up in the Controller (Java Code). In the zul-file you can find only the declaration of the listbox:
<listbox id="thervarianteListbox" width="994px" height="329px" multiple="false" oddRowSclass="myodd"> <listhead sizable="true" width="994px"> <listheader sclass="listeAlignment" label="Zuweisung" image="images/therapie_zuweisungenIcon.png" sort="false" width="22%" /> <listheader sclass="listeAlignment" label="Eigenleistung" image="images/therapie_leistungenIcon.png" sort="false" width="22%" /> <listheader sclass="listeAlignment" label="Dokumentation" image="images/therapie_dokumenteIcon.png" sort="false" width="22%" /> <listheader sclass="listeAlignment" label="Medikamente" image="images/therapie_medikamenteIcon.png" sort="false" width="22%" /> <listheader sclass="listeAlignment" label="Häufigkeit" sort="false" width="12%" /> </listhead> </listbox>
Therefore it is hard to provide an runnable example.
Asked: 2009-06-24 12:42:24 +0800
Seen: 240 times
Last updated: Aug 05 '09