AnsweredAssumed Answered

Turn off  a sublayer when button click on TOC -agsjs

Question asked by MayMay on Jul 23, 2014
Latest reply on Aug 21, 2014 by kenbuja


I download TOC here:

https://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109

I want to create a button like the sample one able to turn on/off a layer.

I only able to turn on a sublayer using setVisibleLayers  method here when a button is clicked.

 

on(dom.byId("SetVisibleLayersProgramatically"),'click', function(evt){

Dynlayer.setVisibleLayers([11]);

   

     });

 

But how do you turn off the same sublayer when another button is clicked?  I don't want to use toc.findTOCNode( Dynlayer, 11).hide().  It will remove the layer.  I would to uncheck the layer instead of remove the layer.

 

Is there any way, simple way to do this task?

 

Thank you.

Outcomes