3

I can add markers to maps, and the marker pin appears ok, but I don't see any titles on them!

I loop through my store and add them like this:

           //plot the points on the map
           for (var i = 0; i < this.getCount(); i++)
           {                 
               var position = new google.maps.LatLng(this.getAt(i).data.Latitude, this.getAt(i).data.Longitude); 
               var marker = new google.maps.Marker({
                    position: position,
                   title : this.getAt(i).data.LocationDesc,
                   map: Ext.ComponentManager.get('jobmap').getMap()
               });
           }

I see pins, but no text title! The data is ok, and I've even tried hard coded strings. Is there some kind of overlay/mask property? How do I get the titles to appear?

EDIT: Below solution solves the issue, but I also thought I'd throw in the solutions to related problems I had.

If you want to place popup info windows on multiple markers you need to read this: Trying to bind multiple InfoWindows to multiple Markers on a Google Map and failing

The infoWindows will be blank until you make the font non-white! Google Maps API InfoWindow not Displaying content

Community
  • 1
  • 1
SteveCav
  • 6,649
  • 1
  • 50
  • 52

1 Answers1

0

As you can see in the MarkerOptions Docs, title property of marker is seen as a rollover text.

I wonder, how it can be seen on smartphone devices, where there's no event like mouseover?

I think you'll need to open some infoWindow on click those pins/markers on map.

You can do it like this,

var infoWindow = new google.maps.InfoWindow({ content:'_address_' }),

and then listen for the click event on the marker,

google.maps.event.addListener(marker, 'click', function() {
        infoWindow.open(map, marker);
});
Saurabh Gokhale
  • 53,625
  • 36
  • 139
  • 164