AnsweredAssumed Answered

Issue on Updateing ArcGIS API for JS Basemap Using jQuery

Question asked by BEHSEINI on Aug 25, 2015

Can you please let me know if it is possible to update ArcGIS API Basemap by using jQuery. I am looking for a hack to bind updating of a array to update the basemap option in the map object

Here is what I have tried

<select id="base-map-options"> 
  <option value="0">Imagery</option>
  <option value="1">Topographic With Lable</option>
</select> 

var map;
var basemap = ['topo','streets','imagarey']

require([ "esri/map",
          "esri/layers/ArcGISDynamicMapServiceLayer",
          "dojo/domReady!" ],
         function(Map) { map = new Map("mapDiv", {
                               center: [-126.687482, 54.793577],
                               zoom: 5,
                               basemap: basemap[0]
           }); 

$("#base-map-options").on("change", function () {
   basemap[$('option:selected').val()];
  });

});

as you can see I am trying to update selected index in basemap[] through

   $("#base-map-options").on("change", function () { 
    basemap[$('option:selected').val()];
   });

but I don't know how to bind this to basemap property of the map object? thanks

Outcomes