-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi to all,
I am using Listboxes and Grids along with data binder. My question is rather simple. Is there a way to have a <A> inside a grid row with label populated from the binded model? I mean, how can i achieve something like this:
<row> <a href="">@{ person.name }</a> </row>
Thanks
Cyiannoulis,
Give this listbox example a whirl. It should give you an idea how to do it.
<?init class="org.zkoss.zkplus.databind.AnnotateDataBinderInit" ?> <zk xmlns:h="http://www.w3.org/1999/xhtml"> <zscript> public class Link { private String url; private String urlDisplay; public Link(String u, String ud) { setUrl(u); setUrlDisplay(ud); } public String getUrl() { return url; } public void setUrl(String u) { url = u; } public String getUrlDisplay() { return urlDisplay; } public void setUrlDisplay(String ud) { urlDisplay = ud; } } List Links = new ArrayList(); Links.add(new Link("http://www.cnn.com", "www.cnn.com")); Links.add(new Link("http://www.apple.com", "www.apple.com")); Links.add(new Link("http://www.yahoo.com", "www.yahoo.com")); </zscript> <window id="win" border="normal" style="padding:25px;"> <listbox id="myListbox" model="@{Links}" selectedItem="@{selected}" > <listhead> <listheader label="URL Link" /> </listhead> <listitem self="@{each=Link}"> <listcell> <h:a href="@{Link.url}"><label value="@{Link.urlDisplay}"/></h:a> </listcell> </listitem> </listbox> </window> </zk>
Regards,
Todd
Thank you so much Todd. This should work fine!
Asked: 2010-10-27 08:23:04 +0800
Seen: 180 times
Last updated: Oct 27 '10