-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hi there,
I'm struggling a bit to access the gmap object in javascript, and I'd appreciate some help.
In my .zul file I have
<gmaps id="gmap" blah blah></gmaps>
<script type="text/javascript"><![CDATA[ function Example() { var mapExample = ? and here is my problem... // how to get the GMap2 object? something like new GMap2(document.getElementById("gmap")) ? mapExample.setCenter(new GLatLng(0, 0), 13); } ]]></script>
henrichen, I have looked at the JavaScript object, but I am still unclear on how to set a new center.... I tried:
var gMaps = zk.Widget.$('$mainMap'); gMaps._gmaps.center = [0.0, 0.0];
and various other combinations to manipulate the widget, but no luck so far. Could you elaborate?
Thanks in advance!
Deven
@InfoSec812,
try if setCenter() works. However, calling directly in browser side might cause data inconsistency risk between browser and server side.
Actually, after MUCH searching, the proper method to call on the Gmaps object in JavaScript is the "panTo([lat,long])" method. The problem I have now is that I have yet to be able to grab the object script-wise and manipulate it... I can manipulate it from Chrome's JavaScript console, but not from my ZK scripts.
How did you solve your problem? I have the same too...
I never did find an answer.
I found the answer, if u want how to access to google api over zkoss, contact me at [email protected] :)
Asked: 2011-06-01 07:31:50 +0800
Seen: 440 times
Last updated: Jul 04 '14