Nobleflow / gmaps4jsf

Automatically exported from code.google.com/p/gmaps4jsf
0 stars 0 forks source link

eventListener doesn't work when map has renderOnWindowLoad=false and marker is specified using lat/long #92

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
As the summary says. With the following code no alert is displayed upon
clicking on marker.

<f:view>
 <h:form id="form">
  <m:map id="t" renderOnWindowLoad="false" width="100%" height="400px"
autoReshape="true">
   <m:marker id="marker1" latitude="30.01" longitude="31.14"
jsVariable="marker1">
    <m:eventListener eventName="click" jsFunction="markerDragHandler"/>    
   </m:marker>
  </m:map>
  <script>
    function markerDragHandler(latlng) {
     alert("Current marker latlng is: " + latlng);      
    }               
  </script>   
 </h:form>
</f:view>

If marker is specified by address instead of latitude/longitude it works as
it should:

<f:view>
 <h:form id="form">
  <m:map id="t" renderOnWindowLoad="false" width="100%" height="400px"
autoReshape="true">
   <m:marker id="marker1" address="Cairo, Egypt" jsVariable="marker1">
    <m:eventListener eventName="click" jsFunction="markerDragHandler"/>    
   </m:marker>
  </m:map>
  <script>
    function markerDragHandler(latlng) {
     alert("Current marker latlng is: " + latlng);      
    }               
  </script>   
 </h:form>
</f:view>

Without renderOnWindowLoad="false" both address and lat/lon defined markers
work correctly.
Version 1.1.3.

Original issue reported on code.google.com by rom...@gmail.com on 23 Dec 2009 at 12:05

GoogleCodeExporter commented 9 years ago
You should not use renderOnWindowLoad="false" unless your map will be rendered 
using
Ajax.

So why setting this attribute to false in this context?

Original comment by Hazem.sa...@gmail.com on 24 Feb 2010 at 11:38

GoogleCodeExporter commented 9 years ago
Fixed in 1.1.4 trunk and in 1.1.3-u4.
Just update the source code and build it to get the jar with the fix.

Original comment by Hazem.sa...@gmail.com on 21 May 2010 at 1:34