Page 1 of 1

Placing markers from a list

Posted: Mon May 09, 2016 10:10 pm
by Gosse Westra

Hi,

I try to place markers on a google map component.
if get my respons from the service i get my database entries in a list on my creen and then i run this JS on event succes but it don't place the markers what i am doing wrong here? this service calls the server code from this geolocation tutorial https://devcenter.appery.io/tutorials...

and this is the java script what i use
//Were "multiGoogleMap" is map component name.
var map = Appery("google_map").options.mapElement.gmap('get', 'map');
var CreateMarker = function(data){
console.log("add marker with coordinates = " + data.lat + " = " + data.long);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(data.lat, data.long),
map: map
});
};
for (var i = 0; i < data.length; i++)
//In this function you should to pass latitude, longitude and text to display in infowindow.
CreateMarker({lat: data.Lat, long: data.Lng, location: data.salary});

this is the mapping what i use

Image

If i use this code for a other service that llist all items from the database then on the event succes it places the markers


Placing markers from a list

Posted: Tue May 10, 2016 11:23 am
by Serhii Kulibaba

Hello,

Please check if there are any errors in the browser console. You can learn here: https://devcenter.appery.io/documenta... how to open the console.


Placing markers from a list

Posted: Tue May 10, 2016 6:21 pm
by Gosse Westra

Hello Sergiy,

Here are a screen shot from de debug console and one from my database Image Image


Placing markers from a list

Posted: Wed May 11, 2016 1:22 pm
by Serhii Kulibaba

It looks like you use in undefined variable "data" somewhere in the loop of your app. Please be sure it is not empty