Closed GoogleCodeExporter closed 9 years ago
Hi,
You can override the widget function '_initListeners' of gmaps and
'initMapitem_' of gmarker then get the real google map object in it,
or assign them id then get widget by id and get the real google map object.
A simple sample:
<zk xmlns:w="client">
<script type="text/javascript"><![CDATA[
var mapsOne,
markerOne,
mapsTwo,
markerTwo;
// get widget and inner item by id
function setObjectsReference () {
mapsTwo = zk.Widget.$('$mapsTwo')._gmaps;
markerTwo = zk.Widget.$('$markerTwo').mapitem_;
}
function showInfo () {
zk.log('lat of first map ' + mapsOne.getCenter().lat());
zk.log('lat of first marker ' + markerOne.getPosition().lat());
if (mapsTwo && markerTwo) {
zk.log('lat of second map ' + mapsTwo.getCenter().lat());
zk.log('lat of second marker ' + markerTwo.getPosition().lat());
}
zk.log('');
zk.log('------------------------');
zk.log('');
}
]]></script>
<!-- override method -->
<gmaps height="250px" width="250px" lat="30" lng="-90">
<attribute w:name="_initListeners">
function (n) {
this.$_initListeners(n);
mapsOne = this._gmaps;
}
</attribute>
<gmarker lat="30" lng="-90">
<attribute w:name="initMapitem_">
function () {
this.$initMapitem_();
markerOne = this.mapitem_;
}
</attribute>
</gmarker>
</gmaps>
<!-- or assign id -->
<gmaps id="mapsTwo" height="250px" width="250px">
<gmarker id="markerTwo" />
</gmaps>
<button label="get second map and marker">
<attribute name="onClick">
Clients.evalJavaScript("setObjectsReference();");
</attribute>
</button>
<button label="test">
<attribute name="onClick">
Clients.evalJavaScript("showInfo();");
</attribute>
</button>
</zk>
Original comment by benbai...@gmail.com
on 20 Mar 2012 at 2:17
When I test this Not working
Original comment by mr.si...@gmail.com
on 22 May 2012 at 11:13
Fixed since 2012-05-28.
Please try the latest freshly and feel free to let me know if there is any
further issue.
Original comment by benbai...@gmail.com
on 28 May 2012 at 9:07
Original issue reported on code.google.com by
s.mara...@gmail.com
on 19 Mar 2012 at 3:39