Hi Robert
Your fix off changing the _show2DWebMap function in the jimu.js/MapManager.js file worked for adding labels when the feature class is created from a URL, but I am still having issues when creating the feature class from a feature collection within the client.
Below is a snippet of the JavaScript where I am setting up the label class and applying it to the feature layer. If the feature layer is created from an existing feature layer from a URL the labeling works (commented out below), if the layer is created from a feature collection it does show the labels. Is there anything else I need to enable to show the labels when using a feature collection?
Thanks for your help so far,
Regards
Anthony
var gridColor = new Color("#000");
var gridLine = new SimpleLineSymbol("solid", gridColor, 1.5);
var gridSymbol = new SimpleFillSymbol("solid", gridLine, null);
var gridRenderer = new SimpleRenderer(gridSymbol);
var featureCollection = {
"layerDefinition": {
"geometryType": "esriGeometryPolygon",
"fields": [{
"name": "grid",
"alias": "grid",
"type": "esriFieldTypeString"
}]
}
};
var GRGLabel = new TextSymbol().setColor(gridColor);
GRGLabel.font.setSize("12pt");
GRGLabel.font.setFamily("arial");
var json = {
"labelExpressionInfo": {"value": "{grid}"}
};
var labelClass = new LabelClass(json);
labelClass.symbol = GRGLabel;
this._featureLayer = new FeatureLayer(featureCollection,{
outFields: ["*"]
});
this._featureLayer.setRenderer(gridRenderer);
this._featureLayer.setLabelingInfo([ labelClass ]);
this.map.addLayer(this._featureLayer);