Select to view content in your preferred language

How to reference layers in map.reorderLayer

2942
0
08-17-2015 03:50 PM
DanNorman
Deactivated User

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 this.map.reorderLayer() 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?

Thanks!

don

startup: function() {
        this.inherited(arguments);
        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 (this.map.itemId) {
          LayerInfos.getInstance(this.map, this.map.itemInfo)
            .then(lang.hitch(this, function(operLayerInfos) {
              this.operLayerInfos = operLayerInfos;
              
              // don edit https://community.esri.com/message/537551#537551 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");
              
              this.map.reorderLayer(Orthophotos,5);
              //end of don edit
              
              this.showLayers();
              this.bindEvents();
0 Kudos
0 Replies