So, I am trying to hide a few layers in Web AppBuilder from the Legend and Layer List Widget. How might I do this? Also, how do I hide the symbols for each layer in Layer List?
Solved! Go to Solution.
Samantha,
There is also this thread that show code changes to make to get this working:
Re: Can I remove layers from my LayerList in a WAB created map?
Samantha,
In AGOL when you are adding layers to your webmap you can click on the triple ellipses next to the layer and choose "Hide in Legend". This is currently the only option.
Robert,
Is there anything I can change in the config, js or json files?
Samantha,
I have look into this and I am still looking into this but I have yet to find something that works.
Samantha,
OK I have figured this out but will need more info from you to provide code and where you should put the code.
It is actually quite simple you just need to obtain an instance of the layer that you want to hide from the Legend and the Layer List widget and assign this:
layer._basemapGalleryLayerType = 'reference';
but what I need to know is:
Robert,
Thank you so much with the help
1. The layer is coming from a webmap. When I do hide the sub-layers in Portal, they do not hide when I open WAB.
2. I want it hidden at startup
"The layer is coming from a webmap. When I do hide the sub-layers in Portal, they do not hide when I open WAB."
I would like to know what version of WAB you found this problem. That is a bug of DevelopVsersion 1.0 and PortalVersion 10.3, bug that bug had fixed in DevelopVsersion 1.1 and PortalVersion 10.3.1.
Samantha,
There is also this thread that show code changes to make to get this working:
Re: Can I remove layers from my LayerList in a WAB created map?
Received, thank you very much Robert.
Xiaodong,
Sure would be nice if there was a configuration option in WAB to hide a layer or sub layer from the LayerList Widget and Legend Widget.