How to add Expand All Layers/Collapse All Layers to LayerList widget in Web AppBuilder?

5788
13
06-14-2016 11:37 AM
MattJunker
New Contributor II

There is an Enhanced LayerList widget for the Flex Viewer. Is there a similar Enhanced LayerList widget for Web AppBuilder? My client would like Expand All Layers/Collapse All Layers functionality in a context menu for the LayerList widget, as they did in their old Flex Viewer app. Any solutions or work-arounds for this issue? Thank you.

0 Kudos
13 Replies
AnaHiraldo-Gomez
New Contributor III

No.  I am not.  Going to defer to my colleagues (the programmers). 

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Matt,

Until the next release comes out you can refer to this thread for a code change to accomplish this:

Layer List: Expand Layers by Default

In WAB Dev 2.0 you would add this code:

if(layerInfo.newSubLayers.length > 0){
          setTimeout(lang.hitch(this,
                     this._onRowTrClick,
                     layerInfo,
                     imageShowLegendNode,
                     layerTrNode,
                     tableNode), 300);

after this code block:

//bind event
      this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode)));

So that it looks like this:

//bind event
      this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendNode,
          layerTrNode,
          tableNode)));
        if(layerInfo.newSubLayers.length > 0){
          setTimeout(lang.hitch(this,
                     this._onRowTrClick,
                     layerInfo,
                     imageShowLegendNode,
                     layerTrNode,
                     tableNode), 300);
devarsimajumder2
New Contributor

where do we add the code in which widget json file do we add this to specifically? Robert Scheitlin, GISP

0 Kudos
RobertScheitlin__GISP
MVP Emeritus