AnsweredAssumed Answered

ArcGIS JavaScript API: Legend and checkbox

Question asked by Geohab on Oct 1, 2014
Latest reply on Nov 7, 2014 by ezequias

Hi All,


I have a web map with three feature layers and one dynamic map layer, and when I use the legend code it is displaying only the three feature layers. What do I need to display all four layers in the legend. Also how do I add a checkbox to display only the checked layers. Here is the code I'm using.



//add the legend
  map.on("layers-add-result", function (evt) {
        var layerInfo =, function (layer, index) {
          return {layer:layer.layer,};
        if (layerInfo.length > 0) {
          var legendDijit = new Legend({
            map: map,
            layerInfos: layerInfo
          }, "legendDiv");