JS 4.x hide layer in layer list

485
1
01-03-2018 11:07 AM
deleted-user-OlpHy1NoMNug
Occasional Contributor II

How do I hide a layer in the layer list widget when the layers are being generated from a AGO web map?  I know I can control the visibility on the layer but I'm not declaring any layers--just pulling over what exists in the web map.  

Scott

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Scott, you need to loop through the web maps layer and use the legendEnabled property on the layer of interest.

https://developers.arcgis.com/javascript/latest/api-reference/esri-WebMap.html#layers