<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman,new york,times,serif;font-size:12pt;color:#000000;"><div>Hi list,<br><br>I try to use Control.SelectFeature but I can`t unselect (selection layer does not get removed). Here is my code:<br>var selectFeature = new OpenLayers.Control.SelectFeature(wfs2, {clickout: true, multiple: false, hover: false, toggle:false, toggleKey: "shiftKey", box: true, multipleKey: "ctrlKey"});<br><br>var wfs2 = new OpenLayers.Layer.Vector("WFS_Waldschutz", <br> { styleMap: styleMap,<br> strategies: [new OpenLayers.Strategy.Fixed()],<br> protocol: new OpenLayers.Protocol.WFS({ <br><span>
url: "<a target="_blank" href="http://myserver:81/geoserver/wfs?service=wfs">http://myserver:81/geoserver/wfs?service=wfs</a>", </span><br><span> featureNS: "<a target="_blank" href="http://mycomp.org">http://mycomp.org</a>", </span><br> featureType: "mylayer", <br> geometryName: "SHAPE", <br> srsName: "EPSG:4326",<br> version: "1.1.0" <br>
<br> }),<br> projection: new OpenLayers.Projection("EPSG:4326")<br> }); <br><br>wfs2.events.on({'featureselected': function(feature){ <br> select.addFeatures([feature.feature]); <br> alert(this.selectedFeatures.length); <br> }, <br>
'featureunselected': function(feature){<br> select.removeFeatures([feature.feature]);<br> alert(this.selectedFeatures.length); alert("unselected");<br> },<br> }); <br><br>var select = new OpenLayers.Layer.Vector("Selection", { <br> styleMap: new OpenLayers.Style(OpenLayers.Feature.Vector.style["select"]), <br> displayInLayerSwitcher:
true, visibility: true});<br><br>featureselected works (at firebug I can see that my app does not get to this break point). What`s wrong?<br><br>Thank you for any hints.<br>best regards<br>Sarah<br><br></div>
</div><br></body></html>