Layer List: Expand Layers by Default

16898
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
GeorgeKatsambas
Occasional Contributor III

Will this work in WAB 2.5? Where does it need to be inserted in the layerlistview.js?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Yes it does. Same place as before.

0 Kudos
GeorgeKatsambas
Occasional Contributor III

I cannot get it to work, and no error in console?

var handle = on(popupMenuNode,
'click',
lang.hitch(this, function() {
var popupMenu = new PopupMenu({
//items: layerInfo.popupMenuInfo.menuItems,
_layerInfo: layerInfo,
box: this.layerListWidget.domNode.parentNode,
popupMenuNode: popupMenuNode,
layerListWidget: this.layerListWidget,
_config: this.config
}).placeAt(popupMenuNode);
this.own(on(popupMenu,
'onMenuClick',
lang.hitch(this, this._onPopupMenuItemClick, layerInfo, popupMenu)));

handle.remove();
}
setTimeout(lang.hitch(this,
this._onRowTrClick,
layerInfo,
imageShowLegendNode,
layerTrNode,
tableNode), 300);
}

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   Sorry that is not the correct spot:

addLayerNode: function(layerInfo, level, toTableNode, position) {
....... 
     //bind event
      handle = this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendDiv,
          layerTrNode,
          tableNode)));
      setTimeout(lang.hitch(this,
         this._onRowTrClick,
         layerInfo,
         imageShowLegendDiv,
         layerTrNode,
         tableNode,
         {}), 300);
      this._layerNodeHandles[rootLayerInfo.id].push(handle[0]);
.....
GeorgeKatsambas
Occasional Contributor III

As alway Robert Thanks, one more question, how can this be changed to expand the TOC layers but not show the symbology (legend)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   Yes the answer to that is earlier in this thread:

https://community.esri.com/thread/160914#comment-557027 

GeorgeKatsambas
Occasional Contributor III

I am missing something then, I put in the code, when I change it as mentioned in previous thread layers disapear from Layer List, if I add it as then it works but with layer expanded to show legend.

  1.  if(layerInfo.newSubLayers.length > 0){  
  2.         setTimeout(lang.hitch(this,  
  3.                    this._onRowTrClick,  
  4.                    layerInfo,  
  5.                    imageShowLegendNode,  
  6.                    layerTrNode,  
  7.                    tableNode), 300);  
  8.       }  
0 Kudos
RobertScheitlin__GISP
MVP Emeritus

George,

   Works perfect for me, so you must have introduced a syntax error again:

      //bind event
      handle = this.own(on(layerTitleTdNode,
        'click',
        lang.hitch(this,
          this._onRowTrClick,
          layerInfo,
          imageShowLegendDiv,
          layerTrNode,
          tableNode)));
      if(layerInfo.newSubLayers.length > 0){
        setTimeout(lang.hitch(this,
           this._onRowTrClick,
           layerInfo,
           imageShowLegendDiv,
           layerTrNode,
           tableNode,
           {}), 300);
      }
      this._layerNodeHandles[rootLayerInfo.id].push(handle[0]);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
SebastianDrexel1
New Contributor

Hi everyone,

is there also some way to automatically expand the second level of the tree (the symbols) but not the first one?

When starting my app and the layer list widget I would like to have all map services collapsed (as it is on default). When expanding a map service the symbology should automatically be displayed without having to expand the layer. For your explanation I've added a screenshot how it should look like in the end when "Mobilität" is expanded.

I'm using Web AppBuilder Developer Edition version 2.0.1.

Thanks for your suggestions in advance!

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sebastian,

  I am not running 2.0 anymore so I can't help with a version that is 6 versions behind.

0 Kudos