-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
i have a databinded listbox. In these listbox i use comboboxes with autocompletion.
The listbox is dynamically generated via databinding.
and these comboboxes don't show their comboitems.
i crated a sample showing my issue:
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit"?> <zk> <zscript><![CDATA[ String[] _dict = { "abacus", "accuracy", "acuity", "adage", "afar", "after", "apple", "bible", "bird", "bingle", "blog", "cabane", "cape", "cease", "cedar", "dacron", "defacto", "definable", "deluxe", "each", "eager", "effect", "efficacy", "far", "far from", "girl", "gigantean", "giant", "home", "honest", "huge", "information", "inner", "jump", "jungle", "jungle fever", "kaka", "kale", "kame", "lamella", "lane", "lemma", "master", "maxima", "music", "nerve", "new", "number", "omega", "opera", "pea", "peace", "peaceful", "rock", "RIA", "sound", "spread", "student", "super", "tea", "teacher", "unit", "universe", "vector", "victory", "wake", "wee", "weak", "web2.0", "xeme", "yea", "yellow", "zebra", "zk", }; ListModel dictModel= new SimpleListModel(_dict); public class ListPOJO { public String name; public ListModel dictModel= new SimpleListModel(_dict); public ListPOJO(String n) { name = n; }; }; List pojos = new ArrayList(); for (int i=0; i<1; i++) pojos.add(new ListPOJO("row "+i)); ]]> </zscript> <vbox> Auto-complete Combobox: <combobox id="combo" autodrop="true" model="${dictModel}"/> </vbox> <label value="${model}"></label> <listbox model="@{pojos}" rows="10"> <listitem self="@{each=item}"> <listcell label="@{item.name}"/> <listcell><combobox autodrop="true" model="${dictModel}" /></listcell> </listitem> </listbox> <combobox id="combo2" autodrop="true" model="${dictModel}"/> </zk>
If you test the sample: the comboboxes on the top and on the bottom are working properly. But the combobox in the listbox isn't showing any items in it's drop down list.
Any ideas?
Thanks & Bye,
Chris
This should help
<listbox rows="10"> <listitem forEach="${pojos}" > <listcell label="${each.name}"/> <listcell> <combobox autodrop="true" model="${dictModel}" /> </listcell> </listitem> </listbox>
and of course you need getter for field "name" of class ListPOJO
public class ListPOJO { public String name; public String getName(){ return name; } public ListModel dictModel= new SimpleListModel(_dict); public ListPOJO(String n) { name = n; }; };
Hi Arsen,
your solution just removes databinding. My list is very dynamic and changing during runtime, so removing databinding is no option. This is just a short sample to demonstrate my issue...
bye,
chris
Asked: 2009-09-17 12:59:38 +0800
Seen: 406 times
Last updated: Oct 06 '09