Closed GoogleCodeExporter closed 8 years ago
This is not an issue at all:
You are trying to pass parameters to the Event handler to do this, change your
JS function as follows:
function selectCoordinate(latitude, longitude) {
return function(latlng) {
alert("You click on (lat, lng): " + latitude + ", " + longitude);
}
}
This will work with both 1.1.3-u3 and 1.1.4-preRelease2-snapshot1[1].
[1]
http://gmaps4jsf.googlecode.com/files/gmaps4jsf-1.1.4-preRelease2-snapshot1.jar
Original comment by Hazem.sa...@gmail.com
on 30 Oct 2010 at 8:51
Attachments:
Hi
As Christoph is trying, im trying to call and actionlistener function on my
backing bean by js function.
This is my JS function
function markerSelected(idMarker) {
return function(latlng) {
alert("setting value a hidden");
document.getElementById('hiddenInput').value = idMarker;
alert("clicking hidden button");
document.getElementById('hiddenBtn').click();
alert("bye");
};
}
and these are my ice componentes and map:
<ice:form id="forma">
<ice:messages />
<ice:inputHidden id="hiddenInput" value="#{papelerasBean.idMarkerSelected}"></ice:inputHidden>
<ice:commandButton id="hiddenBtn" actionListener="#{papelerasBean.muestraDetalle}" style="display:none" />
<m:map type="G_NORMAL_MAP" width="500px" height="500px"
enableScrollWheelZoom="true"
latitude="#{papelerasBean.latitudeGral}"
longitude="#{papelerasBean.longitudeGral}" zoom="17">
<ui:repeat value="#{papelerasBean.papeleras}" var="papelera">
<m:marker latitude="#{papelera.latitude}"
longitude="#{papelera.longitude}" jsVariable="pap#{papelera.id}">
<m:icon shadowImageURL="http://www.google.com/mapfiles/shadow50.png"
imageURL="#{papelera.icon}" />
<m:htmlInformationWindow htmlText="#{papelera.direccion}" />
<m:eventListener eventName="dblclick" jsFunction="markerSelected(#{papelera.id})" />
</m:marker>
</ui:repeat>
<m:mapControl name="GLargeMapControl"></m:mapControl>
<m:polyline lineWidth="5" hexaColor="#ff0000" geodesic="false">
<ui:repeat value="#{papelerasBean.userSelected.ruta}" var="coor">
<m:point latitude="#{coor.latitude}" longitude="#{coor.longitude}" />
</ui:repeat>
</m:polyline>
</m:map>
</ice:form>
The problem is that the java script function only executes the first line:
alert("setting value a hidden");
it does not execute the other alerts, do i do something wrong?
Thanks in advance
Original comment by iban...@gmail.com
on 20 Jan 2011 at 7:22
I guess you have a JavaScript error in this line:
document.getElementById('hiddenInput').value = idMarker;
Check your JavaScript console.
Original comment by Hazem.sa...@gmail.com
on 20 Jan 2011 at 9:44
Original issue reported on code.google.com by
christop...@jki.bund.de
on 7 Sep 2010 at 11:44Attachments: