bpstewar

Feature Layer not symbolizing properly

Discussion created by bpstewar on Jun 4, 2012
Latest reply on Jun 5, 2012 by btfou
I'm adding a fairly basic feature layer to a map using the javascript API, however the symbology isn't coming along. After reading numerous other posts and blogs, I have deciphered that the issue is the fields aren't coming in when I create the feature layer, but why that is, I have no idea. Code is below, please help.

var initialExtent = esri.geometry.geographicToWebMercator(new esri.geometry.Extent(-40, -40, 40, 40, new esri.SpatialReference({wkid:4326}) ));
        map = new esri.Map("map", { 
            extent: initialExtent, 
            slider: true, 
            nav: true,
            wrapAround180: true
        });

        dojo.connect(map, "onLoad", initTools);
   
        var streetMap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer");
        map.addLayer(streetMap);
        
        var content = "<b>Name</b>: ${Name}" +
                  "<br><b>Current Carbon Production</b>: ${cPRes}" +
                  "<br><b>Current Energy Production</b>: ${ePres}";
        var infoTemplate = new esri.InfoTemplate("${FIELD_NAME}", content);
        
        //Add the country summary data
        var infoTemplate = new esri.InfoTemplate("${FIELD_NAME}", content);
        var cntryLyr = new esri.layers.FeatureLayer("http://sdnarc.worldbank.org/SDNARC/rest/services/benMisc/AfricanPowerPlants/MapServer/1",{
          infoTemplate: infoTemplate,
          outFields: ["*"]
        });

        var mapCntryLyr = map.addLayer(cntryLyr)
        

Outcomes