-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi,
it seems that @ expressions parse only dots (.) when accessing the maps; when i try to take the key from a variable putting it in a square brackets, it considers the whole as one var name.
i am trying to do the following example of working with data bound and live list:
<?xml version="1.0" encoding="UTF-8"?> <?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" arg0="./mywin"?> <window id="mywin" border="none"> ZK name check list : <zscript> // prepare persons of one type Set persons = new HashSet(); HashMap person1 = new HashMap(); person1.put("firstName", "mary"); person1.put("lastName", "bearss"); persons.add(person1); HashMap person2 = new HashMap(); person2.put("firstName", "ann"); person2.put("lastName", "moe"); persons.add(person2); HashMap person3 = new HashMap(); person3.put("firstName", "arnold"); person3.put("lastName", "schwartz"); persons.add(person3); HashMap person4 = new HashMap(); person4.put("firstName", "pete"); person4.put("lastName", "boyle"); persons.add(person4); //make a map of persons of several types Map personTypes = new HashMap(); personTypes.put("teachers", persons); String type = "teachers"; </zscript> <listbox model="@{personTypes.teachers}" selectedItem="@{selected}" rows="4"> <listhead > <listheader label="First Name"/> <listheader label="Last Name"/> </listhead> <listitem self="@{each=person}"> <listcell label="@{person.firstName}" /> <listcell label="@{person.lastName}" /> </listitem> </listbox> <grid> <columns> <column label="First Name" /> <column label="Last Name" /> </columns> <rows> <row> <textbox value="@{selected.firstName}" /> <textbox value="@{selected.lastName}" /> </row> </rows> </grid> </window>
this works fine until i try to use the type variable:
<listbox model="@{personTypes [ type ] }" selectedItem="@{selected}" rows="4">
then it shows nothing.
please help - what do i do wrong or is it a bug?
plis remove "[ type ]", we don't support it.
/robbie
Asked: 2009-07-05 11:09:39 +0800
Seen: 180 times
Last updated: Jul 09 '09