AnsweredAssumed Answered

Using dojo.disconnect

Question asked by MoritzP12 on Aug 15, 2016
Latest reply on Aug 16, 2016 by fcbassongis

How can I use dojo.disconnect to remove a map layer I've added. My code doesn't seem to work, it adds the map layer fine but I can't remove it? Any help would be good:

 

<script>

var node = dojo.byId("switch1");
var eventHandle = dojo.connect(node, "onclick", function addMapLayer1(e) {
var soils1 = new ArcGISDynamicMapServiceLayer("https://map/arcgisserver/mapserver", {
opacity: 1,
"visible": true
});

dojo.disconnect(eventHandle);
soils1.setVisibleLayers([1]);
map.addLayer(soils1);

</script>

 

<html>

<div class="switch tiny" style=" float:right;padding-top:0px;">

<input class="switch-input" id="switch1" type="checkbox" name="exampleSwitch">
<label class="switch-paddle" for="switch1">
<span class="switch-active" aria-hidden="true">On</span>
<span class="switch-inactive" aria-hidden="true">Off</span>
</label>

 

 


</div>

</html>

Outcomes