riteshpanchal1 / jquery-ui-map

Automatically exported from code.google.com/p/jquery-ui-map
0 stars 0 forks source link

destroy does not work as expected #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. modify code in current downloadable v3 beta. modify basic example
2. change the js to the following:

$(function() { 
demo.add(function() {
    $('#map_canvas').gmap({'center': '57.7973333,12.0502107', 'zoom': 10, 'disableDefaultUI':true, 'callback': function() {
        var self = this;
        self.addMarker({'position': this.get('map').getCenter() }).click(function() {
            self.openInfoWindow({ 'content': 'Hello World!' }, this);
        }); 
    }});

$('#map_canvas').gmap('destroy');

    $('#map_canvas').gmap({'center': '57.7973333,12.0502107', 'zoom': 10, 'disableDefaultUI':true, 'callback': function() {
        var self = this;
        self.addMarker({'position': this.get('map').getCenter() }).click(function() {
            self.openInfoWindow({ 'content': 'Hello World!' }, this);
        }); 
    }});
}).load();
});

note, i added a destroy call and then i call the same init function a second 
time. 

expected:
code behaves as before the edit

actual:
no marker appears on the map

Original issue reported on code.google.com by mi...@openmile.com on 13 Feb 2012 at 10:19

GoogleCodeExporter commented 9 years ago
Temp. fix: Add jQuery.removeData(this.el[0], 'gmap'); in the destroy method.

Original comment by johansalllarsson on 13 Feb 2012 at 11:02

GoogleCodeExporter commented 9 years ago
see trunk

Original comment by johansalllarsson on 15 Feb 2012 at 3:29