AnsweredAssumed Answered

Grouping Dynamic Map Service in WAB LayerlistWidget

Question asked by Mehretab on Oct 20, 2017
Latest reply on Oct 27, 2017 by rscheitlin

I am trying to organize my layers in the layerlistwidget based on categories, like none responsive text in between different category as in this question. My question here is, is  there a way to do so without the need to group them in ArcMap? 

I also experimented the the add feature collection method as in the code below in my layerlistwidget startup function(see the code ) but the groups ("myGroupLayes" and " myGroupLayes2") are not visible in the layerlistwidget, instead all layers are listed in a flat hierarchy (see the graph below).

// ***begin*** added code in startup() of LayerList/widget.js 
               // First group         
            var featureLayer1 = new esri.layers.FeatureLayer("http://Feature layer URL"); 
            featureLayer1.title = "featureLayer1"; 
            var featureLayer2 = new esri.layers.FeatureLayer("http://Feature layer URL"); 
            featureLayer2.title = "featureLayer2"; 
            var featureLayers = [featureLayer1, featureLayer2]; 
            this.operLayerInfos.addFeatureCollection(featureLayers, "myGroupLayes");
               // Second group
               var featureLayer3 = new esri.layers.FeatureLayer("http://Feature layer URL"); 
            featureLayer3.title = "featureLayer3"; 
            var featureLayer4 = new esri.layers.FeatureLayer("http://Feature layer URL"); 
            featureLayer4.title = "featureLayer4"; 
            var featureLayersSecond = [featureLayer3, featureLayer4]; 
            this.operLayerInfos.addFeatureCollection(featureLayersSecond, "myGroupLayes2");              
            // ***end*** added code in startup() of LayerList/widget.js 


I also tried to group feature layer that are already part of the web map using the solution provided by @Robert Scheitlin, GISP in this thread but with no success. Am I missing something obvious. Also does  the add FeatureCollection support dynamic layers too? Or do we have another means to Group dynamic services as in the case of Feature layers?



For more information I am using WAB 2.6 and I also tried the code in WAB 2.2.