AnsweredAssumed Answered

Basemap Dropdowns do not show labels

Question asked by sarojthapa60 on Jun 2, 2017
Latest reply on Jun 2, 2017 by sarojthapa60

I am trying to display basemaps gallery as dropdowns. The dropdown menu displays a bunch of dropdowns. If I click them, the basemap changes.

 

js:

var dynamicLayer = new ArcGISDynamicMapServiceLayer("https://RESTURL/MapServer");
map.addLayers([dynamicLayer]);

map.on('load', function () {
createBasemapGallery();
});

function createBasemapGallery() {
//console.log("Basemap");
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
});
basemapGallery.startup();

connect.connect(basemapGallery, 'onLoad', function () {
array.forEach(basemapGallery.basemaps, function (dynamicLayer) {
registry.byId("basemapMenu").addChild(new MenuItem({
label: dynamicLayer.title,
onClick: function () {
basemapGallery.select(dynamicLayer.id);
}
}));
});
});
}

  html:

<div style="position:absolute; right:320px; top:145px; z-Index:1;">
  <button id="dropdownButton" label="---Select a Basemap---"  data-dojo-type="dijit/form/DropDownButton">
  <div data-dojo-type="dijit/Menu" id="basemapMenu">

</div>
</button>
</div>

Attachments

Outcomes