dojo.connect(basemapGallery,"onSelectionChange",function(){ var basemap = basemapGallery.getSelected(); alert(basemap.title); });
map1 = new Map("map1", { basemap: "topo", center: [-105.255, 40.022], zoom: 3 });
Hi Ekaitz,Welcome to Esri Forum! Thank you for posting your question here.I looked at our Basemap gallery sample, and you are correct, the map.getBasemap() returns the same basemap that the map was initialized with (e.g. "topo").I think what you need to do to return the basemap from the basemap gallery widget is to use the getSelected() method.Here is a code snippet that should work for that. dojo.connect(basemapGallery,"onSelectionChange",function(){ var basemap = basemapGallery.getSelected(); alert(basemap.title); }); Hope this helps!-Noah
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.