How to reference layers in map.reorderLayer

08-17-2015 03:50 PM
Occasional Contributor

I have successfully added a feature collection of image services to my WAB developer edition application by using the following :Re: Editing LayerList widget to include multiple Groups/Divs of layers

now that I have added this group layer i would like to change the order in the layer list. I am attempting to use the method in the startup function of Widget.js in server\apps\2\widgets\LayerList\Widget.js without any luck. I am guessing the problem is i do not know how to reference which layer i want to move! See line 28. What do i replace the first parameter with to reference my newly added layer?



startup: function() {
        NlsStrings.value = this.nls;
        // summary:
        //    this function will be called when widget is started.
        // description:
        //    according to webmap or basemap to create LayerInfos instance
        //    and initialize operLayerInfos;
        //    show layers list;
        //    bind events for layerLis;

        if ( {
            .then(lang.hitch(this, function(operLayerInfos) {
              this.operLayerInfos = operLayerInfos;
              // don edit code to group layers
              var featureLayer1 = new esri.layers.ArcGISImageServiceLayer("http://ncservgis-prod.XXX.local:6080/arcgis/rest/services/Ortho2010/ImageServer");
              featureLayer1.title = "2010 Orthophotos";
              featureLayer1.visible = false;
              var featureLayer8 = new esri.layers.ArcGISImageServiceLayer("http://ncservgis-prod.XXX.local:6080/arcgis/rest/services/Ortho1996/ImageServer");
              featureLayer8.title = "1996 Orthophotos";
              featureLayer8.visible = false;
              var featureLayers = [featureLayer8, featureLayer7, featureLayer6, featureLayer5, featureLayer4, featureLayer3, featureLayer2, featureLayer1];
              this.operLayerInfos.addFeatureCollection(featureLayers, "Orthophotos");
              //end of don edit
0 Kudos
0 Replies