[OpenLayers-Users] listener function on event "loadend" runs twice

Gabriele Seitz ml-seitz at web.de
Tue Nov 8 04:46:54 EST 2011


Hi there,

why does listener function on event "loadend" run twice? This is new for
2.11.
I asked before, but narrowed the problem down now.

in 2.10 this code works:

layer1 = new OpenLayers.Layer.Vector("bla", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        filter: myfilter,
        protocol: new OpenLayers.Protocol.WFS({
            url: "http:..geoserver/wfs",
            featureType: "..",
            featureNS: ""
        })
    });

layer1.events.register("loadend", this, function(){
		do something with the features, when features are loaded
});    
   
in 2.11 it works only with this workaround, which does not seem right.

layer1 = new OpenLayers.Layer.Vector("bla",
	 ...the same ...
});

var run= 1;
layer1.events.register("loadend", this, function(){
	if (run > 1){
		do something with the features, when features are loaded
	}
	run++;
});  

Whats wrong with my code or with 2.11?

Thanks for your answers.

Gabriele  

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/listener-function-on-event-loadend-runs-twice-tp6973691p6973691.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list