DuncanRager

Legend Only Loads on Zoom

Discussion created by DuncanRager on Jul 19, 2011
Latest reply on Jul 22, 2011 by knapp4550
Greetings,

I have the following code to start my legend:

function addLegend(){
  dojo.connect(map,'onLayerAdd', function(results){
   var legend = new esri.dijit.Legend({
    map:map,
    layerInfos:legendLayers
   },"legendDiv");
   legend.startup();
  });
 }


When I first load my web app, the legend reads, "No Legend", even though I've successfully added layers to my map. Oddly enough, when I mouse wheel to zoom in or out, the legend loads properly.

Similarly, when I use the checkboxes I have to turn other layers on an off, nothing changes in the legend... but when I zoom in or out the legend properly updates.

Could anybody explain this behavior?

Thanks,

DR

Outcomes