Select to view content in your preferred language

Layer List: Expand Layers by Default

18798
60
Jump to solution
06-18-2015 04:26 PM
AdamAraza1
Deactivated User

I thought I had posted this on here already, but I can't seem to find it....

I'm using the tab theme and I have the layer list opening by default in the side panel. Is there a way to have it open with all the layers already expanded showing the symbology without having to click on each individual layer?

0 Kudos
60 Replies
RobertScheitlin__GISP
MVP Emeritus

Daniel,

  If you are trying to do this in WAB 2.1 then the code is now this (line 5 changed):

if(layerInfo.newSubLayers.length > 0){
        setTimeout(lang.hitch(this,
                  this._onRowTrClick,
                  layerInfo,
                  imageShowLegendDiv,
                  layerTrNode,
                  tableNode), 300);
      }
DanielChantlos1
Occasional Contributor

Robert,

Just tried this codeblock, perhaps something else is missing? The layers no longer disappear from the widget, but the MS is still not expanding.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Daniel,

I tested this in WAB 2.1 using the Launchpad theme before posting and it worked fine for me.

0 Kudos
DanielChantlos1
Occasional Contributor

Interesting...this worked after I deleted/re-extracted the WebApp and pasted in the codeblock again.

Thanks as always Robert!

0 Kudos
HenryMoore
New Contributor II

Worked like a charm. Thanks Robert! 

0 Kudos
by Anonymous User
Not applicable

This is AWESOME! Exactly what was needed.

Is there a way to have it only expand the first level? In other words, expand the primary Map Service, and then just show the nested groups, but not those groups contents? I've attached a photo to explain.

I.e. just expand to show 'Public Art' 'Fire Stations' etc and 'Neighborhood ...' but not show the nested layers beneath 'Neighborhood ...' (i.e. Code Enforcement Service Areas, Neighborhood Action Plan, etc.)

Does that make sense?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus
0 Kudos
by Anonymous User
Not applicable

I think that one just hides the symbology of the layers in the Layerlist, or should this not expand group layers as well? I copied the code, but it appears that group layers within the services are also being expanded

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   OK then you want this thread then:

https://community.esri.com/thread/177709 

by Anonymous User
Not applicable

Robert Scheitlin: driving innovation and problem solving for the entire GIS community -- thanks for all you do! I know I speak for everyone when I say your insight and willingness to help is incredibly appreciated. Cheers!