Can Layer List Widget Be Open By Default

4698
8
Jump to solution
06-19-2017 08:07 AM
PatrickMcKinney1
Occasional Contributor III

I'm developing a WAB app using Developer edition 2.4.  I had a couple questions about the Layer List widget:

1. Is it possible to have the widget open when the map first loads?

2. Is it possible to have a map service containing sub-layers to be expanded by default? I have an image of what I would prefer.

list layer widget expanded by default screen shot

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Patrick,

   Sure, to have the widget open at start then you just have to enable the open at start in the widgets settings:

The widget added from the widgets collection can be set to open automatically when apps start. To do so, click the dot on the widget to change it to dark green. A maximum of two widgets can open automatically: one is on the controller and another in the placeholder.

Widget with open at start

For having the layers expanded by default see this thread:

https://community.esri.com/thread/189567-show-legend-in-layer-list-widget-by-default#comment-663376 

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

Patrick,

   Sure, to have the widget open at start then you just have to enable the open at start in the widgets settings:

The widget added from the widgets collection can be set to open automatically when apps start. To do so, click the dot on the widget to change it to dark green. A maximum of two widgets can open automatically: one is on the controller and another in the placeholder.

Widget with open at start

For having the layers expanded by default see this thread:

https://community.esri.com/thread/189567-show-legend-in-layer-list-widget-by-default#comment-663376 

PatrickMcKinney1
Occasional Contributor III

Thanks! Not sure how I missed that. I ended up using a CSS trick to have the list expanded:

/* Layer list expanded by default */
.jimu-widget-layerList table.layer-sub-node {
 display: table;
}

/* layer list legend hidden so it loads properly */
.jimu-widget-layerList table.layer-sub-node .legends-loading-img {
 display: none;
}
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Patrick,

   Hmm. never seen it done with css. Don't forget to mark this question as answered.

0 Kudos
AndrewBartell
New Contributor II

Patrick,

Do you have any links you could share for how to implement that CSS script?  I would love for my layers list to open as expanded, but I'm not sure how to implement the CSS script.  Do you have any additional resources you could share in this tread on this procedure?

Thank you!

0 Kudos
Brownschuh
Occasional Contributor II

Also interested in what you did to the CSS to keep the layer list expanded; not exactly sure which file gets manipulated. 

0 Kudos
by Anonymous User
Not applicable

Robert,

Once the widgets are grouped can one widget be defaulted to expand and the rest be closed?  I have multiple layer list widgets in one grouping, I would like the first one to display when the group is opened and the others to be closed.  Below is what it looks now.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
PatrickMcKinney1
Occasional Contributor III

I've added a Gist on GitHub with the CSS rules for achieving this.  I always create a style.css file for each WAB project, where I store the default rules in the style tag, along with my custom styles.

There are two rules to achieve the result. A sample map can be found at  911 CAD Map .