Thank you VERY much, that is a nice and elegant solution! And also thank you for the hints of memory efficiency!
assonaZkDev004 ( 2021-02-26 15:43:04 +0800 )edit-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi :-)
I included a static html page in a zul file (see code). Now I want to retrieve events (button click on "#button1") from inside the html-page back to ZK (via Composer) and setting some text back into the html (input "#testbox"). Is that possible?
ZUL:
<zk>
<window id="htmlwindow" apply="de.assona.jive.jnh.HtmlPageComposer">
<textbox id="targetBox" name="targetBox" value="" width="150px" />
</window>
</zk>
html:
<div>
<div align="center">
<h1>Included</h1>
</div>
<p>html page</p>
<button id="button1" value="Val01" >Click me</button>
<input id="testbox" type="text">
</div>
composer:
public class HtmlPageComposer extends SelectorComposer<Component> {
...
// wire components
@Wire
private Window htmlwindow;
@Override
public void doAfterCompose(final Component comp) throws Exception {
super.doAfterCompose(comp);
Include htmlinclude = new Include();
htmlinclude.setSrc("/WEB-INF/examples/test.html");
this.htmlwindow.appendChild(htmlinclude);
}
Thank you
YES that's possible: see this example
https://zkfiddle.org/sample/36bqseb/1-communicate-with-included-html
I avoided the Include component since it switches to "defer" in this case making things slightly more complicated (unnecessary for your case). Instead I use an Idspace component avoiding ID clashes with other components. and create the components directly from HTML. Be aware that this creates a ZK component for each HTML element (using the XHTML component set, so you'll need the zhtml.jar dependency).
If you need something more memory efficient, consider combining native elements with xhtml components. (For smaller included html fragments this shouldn't matter.)
See here for a comparison of different namespaces.
Thank you VERY much, that is a nice and elegant solution! And also thank you for the hints of memory efficiency!
assonaZkDev004 ( 2021-02-26 15:43:04 +0800 )editAsked: 2021-02-25 20:15:05 +0800
Seen: 9 times
Last updated: Feb 26 '21
bug with intboxes on mobile devices
zk keikai-how to add custom button/label to formulabar?
zk-keikai- update multiple cells parallel at same time asynchronously
zk-keikai-How to auto fit column width based on text
zk-keikai-ClipboardPateEvent-called twice
Reference a spring bean from VariableResolver