-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi all,
I'm new with zk. So i don't know what is the best way for set the selected value of a Listbox depending of the data value. For exemple, here i want to display on a person, so i want the Listbox to display (select) the right listitem.
<zscript> Person person = new Person("ERT-2009-0001", "Actif", "RST", 1, Calendar.getInstance()) ; groups = new String[] {"ERT", "RST", "CCT", "testg"}; </zscript> .... <row> <label value="Group" /> <hbox> <listbox rows="1" mold="select" selectedItem="@{person.group}"> <listitem label="${each}" value="${each}" forEach="${groups}"
/> </listbox> <image src="img/QuestionmarkButton-16x16.png" tooltip="h_group" popup="h_group" style="cursor:help;"/> <label value="@{person.group}"/> </hbox> </row> ...
"each" is an EL variable and can't be use like this way.
in your case, I'll suggest you use a ListModelList instead of EL foreach.
you can find how to use it by ether searching "zk ListModelList" or typing "ListModel" in ZK Demo's filter.
Asked: 2009-02-09 22:30:33 +0800
Seen: 403 times
Last updated: Feb 10 '09