Select to view content in your preferred language

JS - Turn on/off Map Layers

2496
1
11-07-2014 11:56 AM
ShaningYu
Honored Contributor

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.

Tags (1)
0 Kudos
1 Reply
KenBuja
MVP Esteemed Contributor

Take a look at this post. It shows how to have only one layer on at a time.

0 Kudos