<excludelayerfromlegend>CityAnnexations</excludelayerfromlegend> --> this will remove all of this mapservice from the legend. But NOT all of the time. Sometimes it will randomly show up on the layout. After cleaning my temp files and even restarting my pc.
I've tried the following with no luck to exclude only certains layers in a map service. Can somebody from the ESRI team give me a correct example on how to specifically exclude a layer from a map service with the print widget, or if it is possible to do in 3.1.
At 3.1, it is NOT possible to exclude a layer within a map service, if specified the whole map service would be excluded
Okay that is good to know. Are there any plans to add this to a future release? Sounds like i'll have to reorganize some map services on my end then.
private function getLegendOptions():LegendOptions
{
var result:LegendOptions = new LegendOptions();
var legendLayers:Array = [];
for each (var layer:Layer in hostBaseWidget.map.layers)
{
if (layer.name.indexOf("hiddenLayer_") == -1 && !(layer is GraphicsLayer && !(layer is FeatureLayer)))
{
var isBaseMapLayer:Boolean = false;
for each (var baseMapLayer:Object in hostBaseWidget.configData.basemaps)
{
if (baseMapLayer.label == layer.id)
{
isBaseMapLayer = true;
break;
}
}
if (!isBaseMapLayer)
{
// filter the layer through the list of names of excluded layers.
var isExcludedLayer:Boolean = false;
for each (var excludeName:String in excludeLayersFromLegend)
{
if (excludeName == layer.id)
{
isExcludedLayer = true;
break;
}
}
if (!isExcludedLayer)
{
var legendLayer:LegendLayer = new LegendLayer();
legendLayer.layerId = layer.id;
if (layer is ArcGISDynamicMapServiceLayer && layer.name == "your dynamic mapservice")
{
legendLayer.subLayerIds = ["ids of sublayers to be included"];
}
}
}
}
}
result.legendLayers = legendLayers;
return result;
}
Sarthak:
You replied to Jason's post by saying:
"Yes, we plan to add that as part of the next release. In the meantime, if you are working with the uncompiled version of the viewer, you can update the widget code to do the same:"
Does this answer mean this functionality will be available in FlexViewe 3.2?
Your response is greatly appreciated.