0

URL link in a listbox?

asked 2007-05-01 17:00:41 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

delete flag offensive retag edit

7 Replies

Sort by ยป oldest newest

answered 2007-05-01 17:45:07 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-05-01 17:54:04 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-05-01 19:15:11 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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?

link publish delete flag offensive edit

answered 2007-05-02 01:23:13 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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


link publish delete flag offensive edit

answered 2007-05-02 02:34:51 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-05-02 03:56:34 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


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

link publish delete flag offensive edit

answered 2007-05-02 05:00:27 +0800

admin gravatar image admin
18691 1 10 130
ZK Team


Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4290141

By: sendmarsh

Thanks!! That works perfectly.

Guy

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2007-05-01 17:00:41 +0800

Seen: 1,035 times

Last updated: May 02 '07

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More