AnsweredAssumed Answered

Layer List Widget - Looking to Expand Two Layers on Application Load

Question asked by ipeebles on May 11, 2016
Latest reply on Aug 16, 2017 by dafiter

I have an application using the layer list with legend.  When the application loads, I am looking to have two of the layers automatically expanded.  So far, I can get one to expand on load, but I want another layer.  Here is what I have:



The code to accomplish this task is:


// Layers Widget - Choose Child to be Expanded on Load

layerList.on("load", function() {

  layerList._layersNode.firstElementChild.className += " esriListExpand";



When the application loads, I am wanting these layers to display like the screenshot below:


I was thinking something like this, but it does not seem to work.


//layerList.on("load", function() {

//  layerList._layersNode.secondElementChild.className += " esriListExpand";



Does someone know of another method I can use to have both layers expanded on map load?


Thank you!