David Fung
Posts: 0
Joined: Wed Nov 28, 2012 4:52 pm

Google Map info window not showing

Sorry, I copied the above code but the marker does not display. Anything missing? Thanks!

var newLat = localStorage.getItem("lat");
var newLng = localStorage.getItem("long");

var myLatLng = new google.maps.LatLng(newLat, newLng);

var mapOptions = {
zoom: 15,
center: myLatLng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};

var marker = new google.maps.Marker({
position: myLatLng,
title: "My Location"
});

var infowindow = new google.maps.InfoWindow({
content: 'Hello'
});

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(Tiggr("googleMap").gmap, marker);
});

Tiggr("googleMap").options.mapElement.gmap('addMarker', marker);
Tiggr("googleMap").options.mapElement.gmap(mapOptions);
Tiggr("googleMap").options.mapElement.gmap("refresh");

K. C. Lee
Posts: 0
Joined: Fri Oct 11, 2013 7:51 pm

Google Map info window not showing

Hi,

I am also trying to find out how to get it to work.

May I ask what does
... (on Marker properties add action Run custom JS on click)...mean?

Does it mean to add event on "more property" field of the market property menu
-
property : action
value: "Run customer JS"
add

Or
using the Event manual in the bottom of the GUI for the marker.
When I try to use the Event menu, I cannot get the market click event.

The setting I have
component : Marker1,
Event: Click, and
action: run Javascript

I add an alert("event captured");
in the Javascript.
Test the app, no event generated when click any of the markers in the Google Map demo program.. ...

Thanks for you help...

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Google Map info window not showing

Hello! Please take a look at the screenshot:
Image

K. C. Lee
Posts: 0
Joined: Fri Oct 11, 2013 7:51 pm

Google Map info window not showing

Thanks.
I tried the following code..that works:

var myLatlng = new google.maps.LatLng(37.913344, -122.3540791);
var marker = new google.maps.Marker({
position: myLatlng,
map: map,
title: "Testmarker1"
});
var infowindow = new google.maps.InfoWindow({
content: 'Hello'
});
//clicklistener
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker)
});

But the Event definition in Appery screen has no effects (with or without it , the event fires from the clicklistener you provided in the Javascript.

Could you help me understand what is the actual code and effect of the Appery Event screen in this case?

Do we have to use Tiggr ...?

Thanks.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Google Map info window not showing

Hello! Not sure I understand the question. [quote:]But the Event definition in Appery screen has no effects (with or without it , the event fires from the clicklistener you provided in the Javascript[/quote] in code you've posted there is one listener added for just created marker. There are no other listeners and this one is triggered. Could you clarify what is the problem you have?

K. C. Lee
Posts: 0
Joined: Fri Oct 11, 2013 7:51 pm

Google Map info window not showing

I am confused between the click event defined in the screen vs the click listener code in JavaScript.

If I define an alert("market clicked")
In the marker 2 click action JavaScript,
The alert is not activated when I click any markers that I defineded, except the specific market that has the click listener JavaScript function defined.

You help are appreciated.

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Google Map info window not showing

Hello! Click events you set for marker in builder won't work. You need to add events for markers using JS.

Romulo Manzano
Posts: 0
Joined: Sun Nov 23, 2014 11:50 pm

Google Map info window not showing

Hello! I found this post very useful, however, the listener seems not to be working on my code for some reason :s. The marker is successfully created, but the info window is not :s

My code is below:

.....
var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: 'abc',
animation: google.maps.Animation.DROP
});

var infowindow = new google.maps.InfoWindow({
content: 'Helloo'

});

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(Appery("googlemap1").gmap,marker);
});

....

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Google Map info window not showing

Hi Romulo,

Use following code instead of yours:

pre

google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map, marker);
});

/pre

Regards.

Romulo Manzano
Posts: 0
Joined: Sun Nov 23, 2014 11:50 pm

Google Map info window not showing

Hi Yurii - I've tried both, your code and mine and none of them seem to work. I've also replaced the code by a navigateTo command (to see whether the listener worked) and no results. . I'm not sure whether the listener is being closed..

Thanks

Return to “Issues”