-
FEATURED COMPONENTS
First time here? Check out the FAQ!
I need to control a gmaps (in gmaps.zul file) from a button in another zul file (top.zul).
Both files are included in root.zul.
When I push my button ZK show me a popup error message: "Name is empty or target is null."
Here's my code:
* root.zul **
<?link rel="stylesheet" type="text/css" href="/resources/css/style.css"?>
<zk>
<borderlayout hflex="1" vflex="1">
<north height="100px" border="none" >
<include id="northPanel" src="/top.zul"></include>
</north>
<center id="mainContent" autoscroll="true">
<include src="/gmaps.zul" ></include>
</center>
</borderlayout>
</zk>
* gmaps.zul **
<zk>
<div>
<gmaps id="map" width="500px" height="500px" lat="35" lng="-110" />
</div>
</zk>
* top.zul **
<zk>
<div apply="test.TestComposer">
<button id="btn" label="add marker" />
</div>
</zk>
* TestComposer.java **
public class TestComposer extends GenericForwardComposer {
private Gmaps map;
private double lat = 35;
private double lng = -110;
public void onClick$btn() {
Events.echoEvent("onAddMarker", map, null);
}
public void onAddMarker$map() {
Gmarker marker = new Gmarker();
lat += 0.001;
lng += 0.001;
marker.setLat(lat);
marker.setLng(lng);
marker.setParent(map);
}
}
Hi, you can use EventQueue, please refer to this document.
Asked: 2013-10-17 13:26:47 +0800
Seen: 24 times
Last updated: Nov 27 '13