Solved! Go to Solution.
when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it. Either that or I'm propagating memory leaks ; )
Can I use arrays to streamline the code (obviously using more than one feature layer), like the following:dojo.connect(wfLayers, "onMouseOver", function(evt) {
highlight the geometry onmouseover for whichever layers are visible at any one time... the above function works when clicking the map but does anyone know how to achieve the same but only clicking on the feature layer?
If you save this to a variable, you can use
dojo.disconnect when the layer is switched off.//When the layer is switched on: var1 = dojo.connect(layer1, "onClick"....) //When the layer is switched off: dojo.disconnect(var1)
dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, { mode : esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate : template, outFields : ["*"], }); dojo.connect(dwfLayer, "onMouseOver", function(evt) { map.setMapCursor("pointer"); highlightPointLayer.clear(); highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry)); });
var wfLayers = []; dwfLayer = new esri.layers.FeatureLayer(dwfLayerUrl, { mode : esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate : template, outFields : ["*"], }); wfLayers.push(dwfLayer); dojo.connect(wfLayers, "onMouseOver", function(evt) { map.setMapCursor("pointer"); highlightPointLayer.clear(); highlightPointLayer.add(new esri.Graphic(evt.graphic.geometry)); });
when I hide the feature layer the dojo.connect function is no longer available so I don't have to disconnect it. Either that or I'm propagating memory leaks ; )
Can I use arrays to streamline the code (obviously using more than one feature layer), like the following:dojo.connect(wfLayers, "onMouseOver", function(evt) {