I am trying to hide two layers in my example provided called states and counties. I am trying to use this code to make it happen but I am getting a rootLayer reference error. Not sure why.
//SCRIPT5007: Unable to get property 'rootLayer' of undefined or null reference
//TOC.js, line 906 character 3
//if (serviceLayerId !== null && serviceLayerId !== undefined && w.rootLayer instanceof (ArcGISDynamicMapServiceLayer)) {
toc.findTOCNode(StoresResultsLayer, 2).hide(); //hide States in legend
toc.findTOCNode(StoresResultsLayer, 3).hide(); // hide counties in legend
I created a simple fiddle in hopes that it helps one of you smarter people to help me. Thanks and happy Friday!
Edit fiddle - JSFiddle