Can i create 2 legend objects in one script?
I'm currently working on a web-application in which i already do have a legend/TOC running and it looks like this:
var legendLayers=[];
legendLayers.push({layer:raum, title:'Raumkategorien', slider:true});
map.on("layers-add-result", function(){
var layerInfo = new TOC({
map: map,
layerInfos: legendLayers,
}, "legendDiv");
layerInfo.startup();
});
map.addLayers([raum]);
Now I added some geoprocessing functionality and i wanted to add a new TOC when the result map is loaded in the web-app. I tried this by doing the following:
function gpJobComplete(jobinfo){
var mapurl = mapServiceURL + "/" + jobinfo.jobId;
var energy = new ArcGISDynamicMapServiceLayer(mapurl,{
id:"Beste Energieformen",
"opacity": 0.85
});
map.addLayers([energy]);
var outputLayers = [];
outputLayers.push({layer:energy, title:"Beste Energieformen"});
map.on("layers-add-result", function(){
domUtils.show(dom.byId('outputDiv'));
var outputInfo = new TOC({
map: map,
layerInfos: outputLayers
}, "outputDiv");
outputInfo.startup();
});
}
I get a result map and it works just nice in the web app, but there's no new TOC. Am i trying it the wrong way?