-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I am using zk 3.6.3 version with spring. I can bind the arraylist from zul and composer componenet. Also I can iterate the arraylist and printout the element in the listbox in the front end.
However, I don't want iterate to get all the elements sequentially. I just want to get a particular element wih index i of the list ListA and put it in a Textbox. i found many document and still don't know how to do. Also, I can't find zuml tag support to do the basic looping without UI control (ListBox) help. Anyone can help?
This kind of problem is from the unfamiliar of basic part of the ZK language. I believe somewhere should have comprehensive guide or example. Can anyone send me useful link for reference.
Thanks a lot.
Thanks.
" I just want to get a particular element wih index i of the list ListA and put it in a Textbox."
Listbox.getItemAtIndex(index) may help you.
What do you mean in ZUL page but not in Java?
And you mentioned you want to put something like a "listitem" in a textbox, what's that mean?
maybe you can write a small piece of sample code to illustrate what you want.
Thank you for your patience to listen to me. Here is some of my program
Domain class relationship:
public class Channel implements java.io.Serializable {
private SortedSet<Osd> osds = new TreeSet<Osd>(new OsdComparator());
//getter and setter here
}
public class Osd implements java.io.Serializable {
private String osdName;
//getter and setter here
}
In Composer class:
private Channel selectedChannel;
public void setSelectedChannel(Channel selectedChannel) {
this.selectedChannel = selectedChannel;
}
public Channel getSelectedChannel() {
return selectedChannel;
}
In the zul page, there is a listbox to show the search result
<listbox rows="10"
selectedItem="@{channelComposer.selectedChannel}"
model="@{channelComposer.searchChannelList, load-after='search.onClick'}">
<listhead>
<listheader label="Osd Name" sort="auto" />
</listhead>
<listitem self="@{each=searchChannel}">
<listcell label="@{searchChannel.osdStr}" />
</listitem>
</listbox>
After user select one of the channel, I want to show the channel's osd name in the textbox. But the channel to osd relationship is one to many
But the number of group of textbox is fixed to two set or a number I defined in another place.
<hbox>
<textbox id="cfOsdName0" value="" width="200px" />
<textbox id="cfOsdNameX0" value="" width="50px" />
<textbox id="cfOsdNameY0" value="" width="50px" />
</hbox>
<hbox>
<textbox id="cfOsdName1" value="" width="200px" />
<textbox id="cfOsdNameX1" value="" width="50px" />
<textbox id="cfOsdNameY1" value="" width="50px" />
</hbox>
Here is my question:
1 ) It seems can't use cfOsdName[0] as the textbox id for binding to the composer Textbox [] cfOsdName
2) I try to use @{channelComposer.selectedChannel.osd[0].osdName} to retrieve the osd set element but seems can't.
3) If I want to loop 2 times of the hbox group, how to represent the for loop in the zul page Since the number of hbox with textbox does not tie to the number of osd elements
Thanks a lot.
Annotated Data Binding is some kind of meta programming, it's not EL.
So ther's no "array" concept support.
Just focus on this:
How does ZK know to display the first osd object's "osdName" in channel's osdList while channel selected?
I think the simplest answer is:
@{selectedChannel.firstOsdName}
Asked: 2009-11-14 06:37:47 +0800
Seen: 514 times
Last updated: Nov 17 '09