-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4289491
By: sendmarsh
Is there any way I can have a clickable URL in a listbox?
I like using a listbox to display live data but one column needs to be a URL that users can click on.
Neither of the following methods work..
<zk>
<window id="win1" title="Window 1">
<listbox>
<listitem label="http://zkoss.org/" />
<listitem label="<a href="http://zkoss.org/">zkoss</a>"
/>
</listbox>
</window>
</zk>
Thanks
Guy
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4289550
By: jjcooldoc
Did you try:
<listitem><listcell><a href="...">my Label</a></listcell></listitem>
It seems that this should work.
-JJ
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4289560
By: sendmarsh
Trying:
<listitem><listcell><a href="http://zkoss.org/">ZK</a></listcell></listitem>
results in:
org.zkoss.zk.ui.metainfo.DefinitionNotFoundException: Component definition not
found: a in [LanguageDefinition: xul/html]
Thanks
Guy
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4289670
By: sendmarsh
This solution works:
<zk>
<window id="win1" title="Window 1">
<listbox>
<listitem><listcell>
<html><attribute name="content">
<![CDATA[<a href="http://zkoss.org/">ZK</a>]]>
</attribute></html>
</listcell></listitem>
</listbox>
</window>
</zk>
But... is there any way I can set the link when populated listbox columns from a program, for example currently I populate listcell columns using the SimpleListModel and set values like this:
while(...)
{
..
listModel[i][3] = "string";
..
}
Does the SimpleListModel allow for listcells to be populated with HTML items in this (or equivalent) way?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4290026
By: henrichen
Try the <toolbarbutton/>. See ZK How-Tos.
http://en.wikibooks.org/wiki/ZK/How-Tos#How_to_add_a_hyperlink.3F
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4290077
By: sendmarsh
Thanks Henri, this simplifies my ZUML example to:
<window title="Window 1">
<listbox>
<listitem><listcell>
<toolbarbutton label="ZK" href="http://www.zkoss.org"/> </listcell></listitem> </listbox> </window>
but..
is there any way to do this in a listbox generated with live data as per my example above?
Thanks
Guy
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4290111
By: henrichen
Assume your put the URL at data[2].
public class ItemRenderer implements ListitemRenderer {
public void render(Listitem item, java.lang.Object data) {
new Listcell(data[0]).setParent(item);
new Listcell(data[1]).setParent(item);
//prepare the Toolbarbutton
Toolbarbutton tb = new Toolbarbutton("ZK");
tb.setHref(data[2]);
//prepare the Listcell and attach the Toolbarbutton to it
Listcell cell3 = new Listcell();
tb.setParent(cell3);
//attch the Listcell to the Listitem
cell3.setParent(item);
}
}
/henri
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4290141
By: sendmarsh
Thanks!! That works perfectly.
Guy
Asked: 2007-05-01 17:00:41 +0800
Seen: 1,035 times
Last updated: May 02 '07