I'm having a little issue with this as well. I managed to get the the text box and custom image but I'm having issues with adding a database string in the text box of the clicked marker. Where it says $a.storage["selected_test_storage"].get("$['Name']") + data.location It give me the first value of the column "Name". How can I get "Name" to give the correct name?
var markerLatLng = new google.maps.LatLng(localStorage.getItem('markerLat'), localStorage.getItem('markerLng'));
var infowindow = new google.maps.InfoWindow({
content: 'test content',
maxWidth: 320
});
self.infowindowa = infowindow;
var marker = new google.maps.Marker({
position: markerLatLng,
map: map,
title: data.results[0].address_components[0].long_name,
animation: google.maps.Animation.DROP
});
bounds.extend(markerLatLng);
map.fitBounds(bounds);
google.maps.event.addListener(marker, 'click', function() {
//Set content for infowindow.
Code: Select all
infowindow.setContent('Content of ' + data.results[0].address_components[0].long_name +' ' + $a.storage["selected_test_storage"].get("$['Name']") );
//Open infowindow.
infowindow.open(map, marker);
//Added coded.
google.maps.event.addListener(infowindow, 'domready', function() {
var infoWindowCountent = jQuery(".infoWindowCountent:visible");
var infoWindowElement = infoWindowCountent.parent().parent().parent();
var onClick = function(){
//You can add some other actions on click.
//Note you need replace "start2" with page name you need navigate to.
Apperyio.navigateTo("start2");
};
infoWindowElement.bind("click", onClick);
});
});
for (var i = 0; i < locationHelper.aLocations.length; i++)
//In this function you should to pass latitude, longitude and text to display in infowindow.
CreateMarker({lat: locationHelper.aLocations[i][0], long: locationHelper.aLocations[i][1], location: locationHelper.aLocations[i][2]});