-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi guys,
Firstly I'd like to say that we appreciate all the work that has been contributed to zk.
Hopefully this is a simple problem that is easy to fix if I am pointed in the right direction. I have the following semi working code:
in my GenericForwardComposer
public List<ListItem> getMyListItems() {
return myListItems;
}
in my zul page:
<listbox model="@{mainCtrl.myListItems}">
<listitem self="@{each=myListItem}">
<listcell>
<checkbox label="@{myListItem.name}" />
</listcell>
</listitem>
</listbox>
This is giving me some checkboxes dynamically generated using a list taken from a getter in the GenericForwardComposer, but I don't want to use listbox. I tried the following, but it doesn't work
<zk forEach="@{mainCtrl.myListItems}">
<checkbox label="@{each.name}" />
</zk>
I don't really understand the difference between @{} and ${} as well and it is hard to look up (since they are just symbols)
All help appreciated
thanks,
-Matt
>> I don't really understand the difference between @{} and ${} as well and it is hard to look up (since they are just symbols)
There is a big difference:
${} is JSP-stuff, and is designed as "renderhelp". It's only evaluted during the firsttime rendering. EL is a little bit more flexible, you could use i.e. conditions.
The main advantage: You could EL's for the forEach-Attribute and if-Attribute.
Note: forEach and if are also "renderhelpers" - it is only for the first time build of the GUI
@{} is two-way-binding - you could not use @{} for the attributes forEach and if
the main advantage: 2-way-binding, you can perform extra load and save
For your example:
modeldata: myListItems
${}: you get the checkboxes from the model while the GUI is rendered the first time, if there a change in the model (myListItems) - nothing happens
@{} (with listbox): the same as ${}, but could fire reload the UI via databinder, after the modelchange you could refresh the model with binder.loadXXX or
listbox model="@{mainCtrl.myListItems, load-after=....}">
The problem is, that not all components offer an model - so @databinding is not possible for all GUI-Constructs (i.e. checkboxes without Listbox or Row).
Of course you could try to mix ${} and @{}, but ${} is not reloadable....
Check also this thread.
/Robert
And next time in the help section please.
Asked: 2010-01-11 11:40:21 +0800
Seen: 991 times
Last updated: Jan 12 '10