JS 4.11
I am looking for a way to loop through the layers before they get added to my LayerList object and hide some layers.
I can use listItemCreatedFunction: function (event) { } to access the layers and sublayers, but setting layer items visible to false does not work.
I tried using LayerListViewModel but I could not find documentation on the class, and it just blows up on function not found.
const layerListViewModel = new LayerListViewModel()({
view: view
});
layerListViewModel.listItemCreatedFunction = function (event) {
}
Solved! Go to Solution.
Thanks. I implemented this code to hide subitems.
You'll want to use the listMode property on the layer in order to hide it from the list:
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-Layer.html#listMode
Thanks. I implemented this code to hide subitems.
Is there a way to hide layers in the LayerList widget in ArcGIS API for Javascript in the 3.23 version of the API? I do not believe that the listMode property is available on ArcGIS API for Javascript in the 3.23 version.
This thread shows how to do that with a map scene.https://community.esri.com/thread/232289-remove-layers-from-the-layerwidget