I have a site with two cached map services and one dynamic service.When I add my dynamic layer to my map, I call .setVisibleLayers([ ... ]) to set my desired layers. One of the layers is a group layer, the others are in the "root" level. I pass the "group" level id to .setVisibleLayers([ ... ]) for the group layer as I want all layers in that group visible.I've created a "print" function which is called from a button onclick which executes a simple PrintTask.
function printMap() {
require(["esri/tasks/PrintTask", "esri/tasks/PrintParameters", "esri/tasks/PrintTemplate"],
function(PrintTask, PrintParameters, PrintTemplate){
var url = "http://gisapps/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export Web Map Task";
var template = new PrintTemplate();
template.layoutOptions = {
titleText: "Selected Work",
legendLayers: []
};
template.format = "PDF";
template.layout = "A4 Landscape";
template.exportOptions = {
width: 1024,
height: 786,
dpi: 96
};
var params = new PrintParameters();
params.template = template;
params.map = map;
var printTask = new PrintTask(url);
printTask.execute(params, function(results){
window.open(results.url);
});
}
);
}
When I execute this PrintTask, the grouped layers in my dynamic service do not appear in the output - the other layers do. If instead of supplying the group layer id to .setVisibleLayers[ ... ]) I supply the individual layer ids, they then appear in the PrintTask output.I'm fairly sure this is a bug, because it would seem a bit strange that supplying the group layer id to .setVisibleLayers() would result in all layers in the group becoming visible in the map, but not the output of the PrintTask.