Can I remove layers from my LayerList in a WAB created map?

19464
52
Jump to solution
03-16-2015 01:31 PM
BrianO_keefe
Occasional Contributor III

I have had to replicate, duplicate, and masticate (it means chew, people) several layers on a web map in order to get them to show up like the clients want them to be shown.

However, now I have a LayerList that is obnoxious with repetitive layers.

Can I remove layers from the LayerList?

And how?

Tags (2)
52 Replies
denverweston
New Contributor III

Good Morning,

Does this code implementation work only when the layer list is loaded initially or should it work after you add a layer after the application loads?

0 Kudos
NatalieBuchwald
New Contributor III

Mathias,

Looks like you provided a lot of valuable information here but I must still be missing something. I went to my web maps json and found the "id" of the layer I want to hide from the Layer List widget.

Then I followed the previous instructions and went into the widgets folder of my application, went to the Layer List widget and updated the config.json with the "hide" info.

Then I continued to follow the instructions and went to the LayerListView.js of the widget and made what I thought were the appropriate adjustments.

But so far it's not working. I can still see TransportationLabels at the top of my Layer List in my application.

I'm not sure what I'm missing. Any info or recommendations from anyone would be greatly appreciated. Just for reference I am using the WAB Developer Edition version 2.0. I created the web map in ArcGIS Online (hid the layer from the legend in the web map in AGOL). Used that web map in the Developer Edition builder, downloaded the app, added it to my server. It is currently available (gis.gillettewy.gov/DiscoverGilletteWAB) but I'd like to remove that layer from the Layer List. It was super easy to do in Flex so far not so straight forward here. Any thoughts?

0 Kudos
JasonStanton__GISP
Occasional Contributor

I am having the same issue, has anyone else had this issue and corrected it?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

Sure just use WAB 2.1 as the LayerList widget now has the ability to choose which layers are shown in the LayerList.

JasonStanton__GISP
Occasional Contributor

Robert,

Thanks for the reply.  Unfortunately I don't have the time to convert all of my apps over at this point, so I will just have to deal with it for now.

FYI - I was however able to configure the layerlist 2.1 and 'drop' it in my 2.0 app with success but now the code I used (that you provided me previously) to expand all layers in the 2.0 widget does work in 2.1.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

  The 2.1 LayerList widget has a expand all option too.

JasonStanton__GISP
Occasional Contributor

I know, I just want it to happen automatically so it's one less thing for the user to do.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

  So just execute:

this.foldOrUnfoldAllRootLayers(false); from inside the LayerListView.js

0 Kudos
JasonStanton__GISP
Occasional Contributor

Robert, I added the code successfully but it only expands the layer 'name' so you can see the 'sub layers' (for a lack of a better term) but it does not expand the 'sub layers' so that you can see the symbology, which is what I'm really trying to get at.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jason,

Start a new thread on this and I will see what I can come up with.

0 Kudos