AnsweredAssumed Answered

legend not getting created

Question asked by pvitt on Dec 2, 2013
Latest reply on Dec 2, 2013 by pvitt
Hi - I've pretty much copied the legend dijit sample into my app and the legend isnt getting created.  When I debug it appears that the map.on layers-add-result event isnt getting fired.

here's the code:

 //create the map         map = new Map("mapDiv", {             basemap: "topo",             //center: [-117.4408, 33.8419],             center: [-117.4408, 33.4419],             zoom: 9         });                    dynamicLayer = new ArcGISDynamicMapServiceLayer("", {     });     map.addLayer(dynamicLayer);     featureLayer = new FeatureLayer("", {     });  //add legend map.on("layers-add-result", function (evt) {     var layerInfo =, function (layer, index) {         return { layer: layer.layer, title: };     });     if (layerInfo.length > 0) {         var legendDijit = new Legend({             map: map,             layerInfos: layerInfo         }, "LegendDiv");         legendDijit.startup();     } });

I've got a LegendDiv inside a Title Pane also:

<div style="position: absolute; right: 20px; top: 50px; z-index: 999;">
            <div data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Legend', closable:false,  open:false">
                <div data-dojo-type="dijit/layout/ContentPane" style="width: 380px; height: 280px;
                    overflow: auto;">
                    <div id="LegendDiv">

Any ideas?