Select to view content in your preferred language

Layer List Widget Expand 1 Level

4728
8
Jump to solution
05-27-2016 08:14 AM
JohnLucotch1
Occasional Contributor

Good Morning,  Has anyone had success expanding the Layer List Widget by 1 Level so the sublayers of a map service are only showing? 

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

John,

  Here is the solution:

open the LayerListView.js and find the layerTitleTdNode click event (@ line 272) and add these lines after it @ line 279

If you want to change this for all apps you produce in the future then change this file: client\stemapp\widgets\LayerList\LayerListView.js

If you want to change on specific app then change this file:server\apps\[app#]\widgets\LayerList\LayerListView.js

Lines 10 - 17

      //bind event
      this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode)));
      if(level === 0){
        setTimeout(lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode), 300);
      }

View solution in original post

8 Replies
RobertScheitlin__GISP
MVP Emeritus

John,

  Here is the solution:

open the LayerListView.js and find the layerTitleTdNode click event (@ line 272) and add these lines after it @ line 279

If you want to change this for all apps you produce in the future then change this file: client\stemapp\widgets\LayerList\LayerListView.js

If you want to change on specific app then change this file:server\apps\[app#]\widgets\LayerList\LayerListView.js

Lines 10 - 17

      //bind event
      this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode)));
      if(level === 0){
        setTimeout(lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode), 300);
      }
AndrewNiederhauser1
Deactivated User

Hi Robert, 

I'm using WABDE 2.6. I tried to insert the code you suggested (line 213 instead of 279) but am seeing the Layer List widget now completely blank/empty. Any suggestion you can provide would be greatly appreciated. Below is screenshot of the code in my LayerListView.js. My goal is to expand only the first/initial level of the map service and not the subsequent/all groupings. 

Thanks, 

Andrew

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Andrew,

   It looks like they changed a variable name again. Change your line 217 from imageShowLegendNode to imageShowLegendDiv.

AndrewNiederhauser1
Deactivated User

That did it. Thank you Robert!

0 Kudos
MatthewFletcher
Regular Contributor

This still works in V2.20, add the code after line 351.

V2.20.JPG

0 Kudos
KeithAnderson
Occasional Contributor

On a similar note:

I added Line 7 to emulate the click event on the Popup - Expand All Layers

        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendDiv,
          layerTrNode,
          tableNode)));
            this.foldOrUnfoldAllRootLayers(false);‍‍‍‍‍‍‍
0 Kudos
GeorgeKatsambas
Frequent Contributor

In WAB Developer 2.7 does this code change work?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus