When a user changes a label dynamically, the Legend item for that layer disappears from the Legend and an error saying "unable to load /proxy/?<my map service URL>/legend status: 404" appears in the Console (when looking at the F12 Developer Tools pane).
Here is my code snippet. What could be causing the legend error?
code:
labelClass = new LabelClass({
labelExpression: newLabel, /* such as [OwnerName] */
labelPlacement: lPlacement, /* such as 'always-horizontal' for polygon */
symbol: new TextSymbol()
});
var drawingOptions = new LayerDrawingOptions();
drawingOptions.labelingInfo = [labelClass];
drawingOptions.showLabels = true;
var options = [];
options[lId] = drawingOptions; /* lId = the layer index */
myDynamicLayer.setLayerDrawingOptions(options);
myDynamicLayer.setVisibleLayers(getVisibleLayers());
function getVisibleLayers() {
visiblePoints = [];
/* this function finds all the layers that are checked in the layer list and returns an array of layer indexes */
return visiblePoints;
}
Here are the values of the "options" when using the .setLayerDrawingOptions
Are you still facing a problem with this? If so, could you share a sample app that reproduces the issue?