Select to view content in your preferred language

Group layers in the layerlist widget

20601
42
02-14-2017 09:18 AM
GilbertoMatos
Frequent Contributor

Hello!

I need to create layer grouping within the layerlist widget. I am using version 2.2 of the web appbuilder.

When we created the layers on the server as mapserver, the created groups were respected by the layerlist widget, however, because we needed specific resources, we had to switch to featurelayer and put them as dynamic layers, and with that, the layerlist widget no longer mattered the groups.

Is there any way to do this even manually?

Note: I thought of something like this. Return the layers exactly in the order in which I need to group, and within the assembly loop of the treeview, create a parent node and go adding the layers as children, until the last one or be necessary to create another parent node in the treeview. Can I do this? I just do not know how to proceed, what points to change, etc.



Thank you!
Gilberto.

42 Replies
DougBrowning
MVP Esteemed Contributor

John McEwen, GISP this is awesome!  It is working great for us.  Except we would really like to collapse all but one of them on load.

So it does this for our 4 layer widgets (and always all the same equal size)

But we want this (with the bottom 3 collapsed)

Do you know a way to do this?

Thanks 

0 Kudos
by Anonymous User
Not applicable

Hi Doug Browning, one thing you could do is just use a click(); function to click on the collapse element, on the widgetOpen event.  I use that to auto-expand some of the layers in my layer list, such as the wetlands.  Take a look - www.sagis.org/map  notice how the wetlands are expanded automatically, as is the main map layers service. That is a simple way sometimes to achieve this, if you can't find the method to trigger an event in WebApp Builder.  

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Doug,

  You can look at this thread for how to make code changes so you can configure which lists are open by default and collapsed by default.

https://community.esri.com/thread/237493-is-it-possible-to-collapse-multiple-layer-lists-by-default

by Anonymous User
Not applicable

Ah indeed a more proper way to do it, with native methods. Thank you for your insight Robert as always.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Yep that is my coworker.  We are not using the full WAB just the web one and it seems like it will not work.  Getting the full one is not easy around here.

Is there any other way?  Seems weird there is no checkbox in config for this.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nope no other way.

0 Kudos
DougBrowning
MVP Esteemed Contributor

Well that is a major bummer.  It was really looking nice.  Can we set the sizes or anything?  They all get even space and are all expanded.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Nope that is all handled in the code. Nothing you can do with just the config.

DougBrowning
MVP Esteemed Contributor

Is there an easy way to port what we got so far over to the full WAB?  Or do we start over?

thanks

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Doug,

You can build a 2D or 3D app on top of an existing app by importing it from your ArcGIS Online organization or Web AppBuilder account.

https://developers.arcgis.com/web-appbuilder/guide/create-import-app.htm

0 Kudos