Select to view content in your preferred language

Layer List: Expand Layers by Default

18263
60
Jump to solution
06-18-2015 04:26 PM
AdamAraza1
New Contributor II

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

George,

   What do you mean

I cannot see where to add the code mentioned above.

What version of WAB are you using?

0 Kudos
GeorgeKatsambas
Occasional Contributor III

sorry i thought i was replying to the main thread, what I want is the mapservices which are grouped to expand once the map is opened without clicking each drop down arrow. 

In the thread there was a code block to add to the layerlistview.js

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

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

  You are replying to the correct thread but I am not sure why you made the generic statement

I cannot see where to add the code mentioned above.

Can you be more specific? What version of WAB are you using?

0 Kudos
GeorgeKatsambas
Occasional Contributor III

WAB 2.3, i want in the TOC all the map services to expand when opened. I assume i need to modify the layerlistview.js in the WAB/client/stemap/widgets/layerlist folder by adding some code. For some reason I was under impression 2.3 automatically had the option to expand the TOC.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

2.3 does have a LayerList menu option to expand all layers in the list but it is a menu option at runtime and not something that is configurable in the widgets settings dialog. If you want to expand the LayerList widget automatically then you have to add code to the LayerListView.js as this thread suggests.

For 2.3 you should look at this thread for the proper code changes:

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

GeorgeKatsambas
Occasional Contributor III

Thanks Robert, where is the menu option at runtime? I am not understanding that. Will it help if I attach my layerlist widget.js?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   It is just to the right of the "Operational Layers" text in your LayerList widget (the icon with lines and a checkmark).

0 Kudos
GeorgeKatsambas
Occasional Contributor III

Oh I thought that is what you meant, but, I want to eliminate the user clicking that and all layers opening automatically, but I can live with this for now.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Well that is what the other thread will do, based on the code changes (expand all layers automatically).

GeorgeKatsambas
Occasional Contributor III
  1. if(layerInfo.newSubLayers.length > 0){  
  2.         setTimeout(lang.hitch(this,  
  3.                   this._onRowTrClick,  
  4.                   layerInfo,  
  5.                   imageShowLegendDiv,  
  6.                   layerTrNode,  
  7.                   tableNode), 300);
  8. Inserting the above is now removing/not showing my map services? WAB 2.4 Foldable theme. This is what the code looks like
  9. _________________________________________________________________________________________________
  10. if(layerInfo.newSubLayers.length > 0){
    setTimeout(lang.hitch(this,
    this._onRowTrClick,
    layerInfo,
    imageShowLegendDiv,
    layerTrNode,
    tableNode), 300);
    this.own(on(imageShowLegendDiv,
    'click',
    lang.hitch(this,
    this._onRowTrClick,
    layerInfo,
    imageShowLegendDiv,
    layerTrNode,
    tableNode)));

Have i forgotten a colon again? rscheitlin

0 Kudos