I'm trying to build a basemap Gallery menu button without the ArcGIS basemaps and can't seem to get the following code to work.
[HTML] /* New Basemap */ var newBaselayer = new esri.dijit.BasemapLayer({url: "http://mapserv.utah.gov/ArcGIS/rest/services/UtahBaseMap-Imagery2009/MapServer"}); var newBasemap = new esri.dijit.Basemap({layers: [newBaselayer],title: "2009 images"}); basemaps.push(newBasemap); /* New Basemap */ var hybridLayer = new esri.dijit.BasemapLayer({url: "http://mapserv.utah.gov/ArcGIS/rest/services/UtahBaseMap-Hybrid/MapServer"}); var hybridLayerNew = new esri.dijit.Basemap({layers: [hybridLayer],title: "Hybrid 2009"}); basemaps.push(hybridLayerNew); /* Create Gallery and Populate Drop Down Menu */ basemapGallery = new esri.dijit.BasemapGallery({ showArcGISBasemaps: false, basemaps:basemaps, map: map },"basemapGallery"); dojo.connect(basemapGallery,"onLoad",function(){ dojo.forEach(basemapGallery.basemaps, function(basemap) { //Add a menu item for each basemap, when the menu items are selected dijit.byId("basemapMenu").addChild(new dijit.MenuItem({ label: basemap.title, onClick: dojo.hitch(this, function() { this.basemapGallery.select(basemap.id); }) })); }); });[/HTML]
When I set the BasemapGallery option "showArcGISBasemaps" to false, the drop down menu should only populate with the basemaps that I've defined, but it doesn't show anything. When I set the BasemapGallery "showArcGISBasemaps" to true, the drop down menu populates with the ArcGIS Basemaps and the ones I've defined. Could someone please instruct me in how to populate the dropdown menu with just the basemaps I've defined?
Removed some of the fluff and then used links to your map services...the code is all there in the JS Fiddle link. I'm honestly not sure what the difference is between the code in the fiddle and what you posted.