How to show specific layers only in the LayerList

201
3
Jump to solution
a week ago
ForrestLin
Occasional Contributor

LayerList will show all layer from map.layers in the list.

We will add layers to map.layers programmatically and don't want to show all layer from map.layers in the list.

How to show specific layers in the list.

Tags (1)
0 Kudos
2 Solutions

Accepted Solutions
Egge-Jan_Pollé
MVP Regular Contributor

LayerList | API Reference | ArcGIS Maps SDK for JavaScript 4.29 | ArcGIS Developers:

To hide layers in the map from the LayerList widget, you must set the listMode property on the desired layers to hide.

View solution in original post

0 Kudos
MatthewDriscoll
MVP Alum

Either set the layers you don't want listMode to "hide" or if you have a service with a lot of layers, like a MapImageLayer use the sublayers.  

View solution in original post

0 Kudos
3 Replies
Egge-Jan_Pollé
MVP Regular Contributor

LayerList | API Reference | ArcGIS Maps SDK for JavaScript 4.29 | ArcGIS Developers:

To hide layers in the map from the LayerList widget, you must set the listMode property on the desired layers to hide.

0 Kudos
MatthewDriscoll
MVP Alum

Either set the layers you don't want listMode to "hide" or if you have a service with a lot of layers, like a MapImageLayer use the sublayers.  

0 Kudos
ForrestLin
Occasional Contributor

@Egge-Jan_Pollé @MatthewDriscoll 

Thank you!

Forrest

0 Kudos