AnsweredAssumed Answered

How do I add desired layers to a Layer List?

Question asked by dschatt on Apr 1, 2016
Latest reply on Apr 4, 2016 by dschatt

hi, I'm a new user of this dijit and I can't get my two layers (a dynamic map service and a tiled map service base map) to show up in the layer list properly. Tried two different ways:


1)  When I add my base map as a "basemap" property in my map, both layers do display, but the base map displays in the LayerList as "layer0".  Setting the "id" property of the map to the name I want doesn't change that. So how do I change the name that is displayed?


2)  When I explicitly create the base map layer by creating a new ArcGISTiledMapServiceLayer, the LayerList will only display whichever layer is added first in the map.addLayer statement.  How do I get it to add all the layers?


Code below, sorry the code insertion thing just isn't working for me so it's regular text.  Thanks much for any tips!



map = new Map("map", {

    //basemap: "topo",

    id: "Base map",

    center: [-76.7, 37.786],

   /zoom: 11

    scale: 2000000



// Add base layer

var basestreet = new ArcGISTiledMapServiceLayer("", {

      id: 'street'




// Add dynamic layer

var shorelineAssessmentMapperLayer = new ArcGISDynamicMapServiceLayer

("", {

          id: 'Shoreline Assessment Mapper'




map.addLayer(basestreet, shorelineAssessmentMapperLayer);


// Create layer list

var myWidget = new LayerList({

        map: map,

        layers: [],

        showLegend: true,

        showSubLayers: true