AnsweredAssumed Answered

TOC adding layer into TOC after initial startup

Question asked by deleted-user-yA_w_FC9FKe5 on Oct 2, 2014
Latest reply on Oct 3, 2014 by deleted-user-yA_w_FC9FKe5

I have my layers that I load up during the initial start up of my map that you can see below.  However, I have a layer that I add in later like this:

      StoresResultsLayer.setVisibleLayers([3, 4]);



I would like this to show up in my table of contents but I would also like to allow the user the ability to turn the individual layers on and off as well.  I'm going to have one be my results for my layer and the other will be labeling for those layers.  How can I do this?





Below is my code on startup for the TOC

map.on("layers-add-result", function (results) {

var toc = new TOC({

                  map: map,     

                  layerInfos: [{

                    layer: dlDRegionDistrictPolygons,

                    title: "Boundary Files",

                    collapsed: true,

     showGroupCount: false,

     slider: true


                    layer: dlMCY_Stores,

                    title: "Macys Stores",

                    collapsed: true



                }, 'sliderDiv');


     toc.on('toc-node-checked', function (evt) {

    // When dlMCY_Stores is turned off I want flMCY_Stores_Labels to turn off as well and vice versa.     

       if(dlMCY_Stores.visible == true){

        //Show feature layer Labels because dynamic layers allow for infotemplate;



        //Hide Labels



     } );