AnsweredAssumed Answered

JS - Turn on/off Map Layers

Question asked by shaningesri on Nov 7, 2014
Latest reply on Nov 10, 2014 by kenbuja

In a TOC panel, there are several Operational Layers, each one has a checkbox.  I added these layers by the piece of code below:

            var sliderTOC = new agsjs.dijit.TOC({               

                map: map,

                layerInfos: [{

                     layer: operational1,

                     title: "by Site",

                    noLayers: true

                 }, {

                     layer: operational2,

                     title: "by Zip",

                     noLayers: true

                 }, {

                     layer: operational3,

                     title: "Distribution",

                     noLayers: true

                 }], style: 'inline'

            }, 'sliderDiv');             sliderTOC.startup();

Initially, one of the feature layer is on and others are off,  I want to add a such a function that when I click one of the checkbox, this layer is on and other layers are off.

Where and how can a piece of code be added to implement this function?  Thanks for your help.

Outcomes