asroboy / google-maps-utility-library-v3

Automatically exported from code.google.com/p/google-maps-utility-library-v3
Apache License 2.0
0 stars 0 forks source link

Can't delete Marker made with MarkerWithLabel for V3 #187

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Demo link or sample code:
        var markers = {};
  var marker = new MarkerWithLabel({
                            position: new google.maps.LatLng(returnobj[prop].lat, returnobj[prop].lon, false),
                            map: thegmap,
                            draggable: false,
                            labelContent: returnobj[prop].name,
                            labelClass: "mwlabel1", // the CSS class for the label
                            labelInBackground: false,
                        });
                        // blank png to remove the marker symbol
                        marker.icon = "blank1x1.png"
                        // the markers array stores the reference
                        markers[0] = marker;

and then I try to remove the markers like this:
                      geoteo.markers[0].setMap(null);

What steps will reproduce the problem?
1. create a new marker with above code
2. try to delete it with geoteo.markers[0].setMap(null);
3. realize it's still there
4. also try  delete geoteo.markers[0];
5. resign in frustration ;)

Expected result:
the marker should disappear

Actual result:
marker remains

Version: 1.1.5 

Browser / Operating System:
Chrome  20.0.1132.47

Additional comments:

Original issue reported on code.google.com by freijona...@gmail.com on 14 Jul 2012 at 6:49

GoogleCodeExporter commented 8 years ago
Are markers successfully removed if you change "new MarkerWithLabel" to "new 
google.maps.Marker" ? (Your labels won't appear of course.)

Original comment by garylitt...@gmail.com on 13 Aug 2012 at 11:12

GoogleCodeExporter commented 8 years ago
just do markers[0].setMap(null) ( or marker.setMap(null) )
what is geoteo ? 

Original comment by jsgal...@gmail.com on 16 Aug 2012 at 4:12

GoogleCodeExporter commented 8 years ago
marker.setMap(null) does not work in my case

Original comment by janjetov...@gmail.com on 5 Feb 2016 at 1:07