-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4886277
By: varan78
How do you specify eventlisteners for links in the contents of an html component?
I am constructing my components using plain java and have code like this:
Html html=new Html();
html.setContent(content)
html.setParent(window)
Here content is a (long) string containing a lot of elements to which I want to add eventlisteners, and window is the parent component of the Html component.
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4888302
By: jebberwocky
Refer to javadoc
http://www.zkoss.org/javadoc/3.0.4/zul/
addEventListener method
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4888688
By: varan78
I don't see how that works unless you change the Html to a group of other components.
For example, of the string content is
"This is a test link of ZK"
and I want to link ZK to something else, i.e., have the same effect as
"This is a test link of <a href='http://www.zkoss.org'>ZK</a>"
and set html.setContent(content) where content is the string above, what kind of event should the EventListener be added for?
Orignial message at:
https://sourceforge.net/forum/message.php?msg_id=4898366
By: henrichen
I am afraid that you cannot add event listener under such context. The <html> component is used to "show" native html "AS IS". Meaning ZK does not have control in its contents. ZK simply "output" them "AS IS".
However, you can use <toolbarbutton> to simulate something like that.
<label pre="true" value="This is a test link of "/><toolbarbutton label="ZK"
href="http://www.zkoss.org"/>
And you should be able to add event listener on <toolbarbutton> component.
/henri
Asked: 2008-04-05 16:40:17 +0800
Seen: 487 times
Last updated: Apr 11 '08