Web AppBuilder- Legend and Layer List Widget

6387
9
Jump to solution
07-08-2015 09:17 PM
SamanthaLines
New Contributor

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?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

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?

View solution in original post

0 Kudos
9 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

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.

SamanthaLines
New Contributor

Robert,

Is there anything I can change in the config, js or json files?

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Samantha,

   I have look into this and I am still looking into this but I have yet to find something that works.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

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:

  1. will the layer be coming from a webmap or a widget like the Local Layr widget?
  2. Do you want it hidden at startup or when a widget is launch, button clicked, etc?
0 Kudos
SamanthaLines
New Contributor

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

0 Kudos
XiaodongWang
Esri Contributor

"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.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

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?

0 Kudos
XiaodongWang
Esri Contributor

Received, thank you very much Robert.

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

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.