-
1. Re: Problem with gmap zoom
sergeysmirnov Mar 20, 2008 2:11 PM (in response to leiras)zoom attribute is read-only. When you change zoom on the client, it does not update the bean on the server.
If you want to synchronize them, you need to do it explicitly. Use a4j:jsFunction that is called from the gmap callback function. Refer to the gmap manual how to add your callback function on zoom changes -
2. Re: Problem with gmap zoom
leiras Mar 20, 2008 2:28 PM (in response to leiras)Sergey,
where should be my function that is activated when the zoom changes?
On the client or on the server side?
Do you have some example?
Thank you for your help. -
3. Re: Problem with gmap zoom
sergeysmirnov Mar 20, 2008 2:43 PM (in response to leiras)gmap itself is a pure client-side widget. It has no idea about the server side. So, all function are on the client.
-
4. Re: Problem with gmap zoom
leiras Mar 20, 2008 3:14 PM (in response to leiras)Please take a look at my current code.
I added an event to the map that fires wen the zoom changes:GEvent.addListener(map, "zoomend", function() { zoomChanged(); });
And here are my JSFunctionsfunction getCurrentZoom() { return map.getZoom(); } function zoomChanged() { alert('Zoom Changed : '+getCurrentZoom()); }
So, when i change the zoon, apears the message "Zoom Chenged : zoomValue".
Now i need to pass the zoom value to my bean.
I tryed to do this:<a4j:jsFunction name="zoomChanged"> <a4j:actionparam name="xxx" value="getCurrentZoom()" assignTo="#{myBean.zoomMapa}" /> </a4j:jsFunction>
and delete the piece of codefunction zoomChanged() { alert('Zoom Changed : '+getCurrentZoom()); }
but it did not work.
The value assigned to "myBean.zoomMapa" was the String "getCurrentZoom()", and not the zoon value.
Any sugestions? -
5. Re: Problem with gmap zoom
sergeysmirnov Mar 20, 2008 3:37 PM (in response to leiras)<a4j:actionparam name="xxx" noEscape="true" value="getCurrentZoom()" assignTo="#{myBean.zoomMapa}" />
-
6. Re: Problem with gmap zoom
leiras Mar 20, 2008 5:08 PM (in response to leiras)I found another solution:
GEvent.addListener(map, "zoomend", function() { zoomChanged(map.getZoom()); });
<a4j:jsFunction name="zoomChanged"> <a4j:actionparam name="zc1" assignTo="#{myBean.zoomMapa}" /> </a4j:jsFunction>
Thank you very much for the help! -
7. Re: Problem with gmap zoom
v.bannur Mar 10, 2011 9:00 AM (in response to leiras)Hi Marcelo,
May I know where this event '
GEvent.addListener(map, "zoomend", function()' y
ou kept in code?
I have kept like this as below and am getting JS error as map is undifined.
<a4j:outputPanel>
<script>
GEvent.addListener(this.map, "zoomend", function() {
zoomChanged();
});
</script>
</a4j:outputPanel>