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?
Solved! Go to Solution.
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?
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?
I am having the same issue, has anyone else had this issue and corrected it?
Jason,
Sure just use WAB 2.1 as the LayerList widget now has the ability to choose which layers are shown in the LayerList.
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.
Jason,
The 2.1 LayerList widget has a expand all option too.
I know, I just want it to happen automatically so it's one less thing for the user to do.
Jason,
So just execute:
this.foldOrUnfoldAllRootLayers(false); from inside the LayerListView.js
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.
Jason,
Start a new thread on this and I will see what I can come up with.