jsn

why is the legend not showing

Discussion created by jsn on Dec 13, 2012
Latest reply on Dec 14, 2012 by jsn
Hi all

this is one of my first programs where I am trying to display the legend on a tab

what is missing to show the legend.

thanks


   
var dynamicUrl = "http://<server>j/ArcGIS/rest/services/OneLayer/MapServer";
           var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer(dynamicUrl );
        
         
          dojo.connect(map,'onLayersAddResult',function(results){
              //add the legend            
              var legend = new esri.dijit.Legend({
                  map: map,
                  layerInfos: [{ layer: dynamicLayer, title: ""}],
                  arrangement: esri.dijit.Legend.ALIGN_RIGHT
              }, "legendDiv");
              legend.startup();        
             });          
         
                


            map.addLayer(dynamicLayer);
   
        }


        //show map on load 
        dojo.addOnLoad(init);
    </script>
</head>

<body class="soria">
    <form id="form1" runat="server">
    <div id="mainWindow" dojotype="dijit.layout.BorderContainer" design="headline"
    gutters="false" style="width:100%; height:100%;">
      <div id="header" dojotype="dijit.layout.ContentPane" region="top">
        This is the header section
       <div id="subheader">subheader</div>
      </div>

      <div dojotype="dijit.layout.ContentPane" id="leftPane" region="right">
        <div dojotype="dijit.layout.TabContainer" >







    
              
          <div id="layersTab"  dojotype="dijit.layout.ContentPane"  title="Layers" selected="true"  style="display: none; margin-bottom: 5px;">
           
           <br />
                  <div id="layersToc">


                  </div> 
                  <br />

           </div>

          <div dojotype="dijit.layout.ContentPane" title = "Legend" >
            <div id="legendDiv"></div>
          </div>
         
        </div>
      </div>
      <div id="map" dojotype="dijit.layout.ContentPane" region="center">
      </div>
      <div id="footer" dojotype="dijit.layout.ContentPane" region="bottom" >
        this is the footer section
      </div>
    </div>
    </form>
</body>
</html>

Outcomes