AnsweredAssumed Answered

Create a base map gallery list in a drop down button using AMD

Question asked by kenbuja Champion on May 17, 2013
Latest reply on May 13, 2014 by sarahclark
I'm attempting to convert the example that Kelly wrote to add the basemap gallery basemaps to the map in a dropdown button into AMD. I'm running into a problem with getting the base maps added to the button. In this function, the ForEach loop fires, but the children aren't added. I've created a fiddler with the new code and original code commented out.

                         function createBasemapGallery() {                 var basemapGallery = new BasemapGallery({                     showArcGISBasemaps: true,                     map: map                 });                  connect.connect(basemapGallery, 'onLoad', function () {                     array.forEach(basemapGallery.basemaps, function (basemap)                          dom.byId('basemapMenu').addChild(new dijit.MenuItem({                             label: basemap.title,                             onClick: lang.hitch(this, function(){                                 this.basemapGallery.select(basemap.id);                             })                         }));                     });                 });             } 

Outcomes