[OpenLayers-Users] event loadend for layer different 2.10 to 2.11

Gabriele Seitz ml-seitz at web.de
Thu Oct 20 06:37:52 EDT 2011


this code worked up to OL2.10. Its part of a function to display features as
WFS that are selected from a list.

    DBsellayer = new OpenLayers.Layer.Vector("Selected Features", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        filter: myfilter,
        protocol: new OpenLayers.Protocol.WFS(...)
    });
    
    map.addLayers([DBsellayer]);
    DBsellayer.events.register("loadend", DBsellayer, function(){
        var scont =
map.getControlsByClass('OpenLayers.Control.GetFeature')[0];     
        if (DBsellayer.features.length > 0) {
			
            anzeigeLayer.removeFeatures(anzeigeLayer.features);
            for (var w = 0; w < DBsellayer.features.length; w++) {
                var myFeat = DBsellayer.features[w];
                anzeigeLayer.addFeatures([myFeat]);
                scont.features[Math.random()] = myFeat;
            }
        }
        else {
            alert("No features found!");
        }
    });

In OL2.11 first there is the alert ("No features found!"), then the features
are displayed correctly. 
It seems to run twice. What has changed in 2.11?

I tried new event type "added" by just replacing the "loadend", but then the
event  is never risen.

Thanks for your answers.

Gabriele


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/event-loadend-for-layer-different-2-10-to-2-11-tp6912423p6912423.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list