Page 2 of 3

Google Map info window not showing

Posted: Thu May 09, 2013 4:23 pm
by David Fung

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");


Google Map info window not showing

Posted: Mon Oct 28, 2013 8:55 pm
by K. C. Lee

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...


Google Map info window not showing

Posted: Mon Oct 28, 2013 9:07 pm
by Maryna Brodina

Hello! Please take a look at the screenshot:
Image


Google Map info window not showing

Posted: Tue Oct 29, 2013 7:21 pm
by K. C. Lee

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.


Google Map info window not showing

Posted: Tue Oct 29, 2013 10:08 pm
by Maryna Brodina

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?


Google Map info window not showing

Posted: Wed Oct 30, 2013 1:01 am
by K. C. Lee

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.


Google Map info window not showing

Posted: Wed Oct 30, 2013 7:46 pm
by Maryna Brodina

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


Google Map info window not showing

Posted: Sun Nov 23, 2014 11:50 pm
by Romulo Manzano

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);
});

....


Google Map info window not showing

Posted: Mon Nov 24, 2014 4:52 am
by Yurii Orishchuk

Hi Romulo,

Use following code instead of yours:

pre

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

/pre

Regards.


Google Map info window not showing

Posted: Mon Nov 24, 2014 5:17 am
by Romulo Manzano

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