AnsweredAssumed Answered

Replace web map in widget code?

Question asked by GSheppard-esristaff Employee on Oct 30, 2014
Latest reply on Aug 6, 2015 by slcemcphee33

How do you write code in a widget to replace an app's web map?

 

I attempted to use esri/arcgis/utils like this:

 

arcgisUtils.createMap(myWebMapId, this.map.id).then(lang.hitch(function(response) {

    this.map = response.map;

}));

 

This code did not visibly change the map control. Then I had an idea to clear the contents of the map div before loading the map:

 

var mapDiv = dom.byId(this.map.id);

mapDiv.innerHTML = "";

arcgisUtils.createMap(myWebMapId, this.map.id).then(lang.hitch(function(response) {

    this.map = response.map;

}));

 

In this case, the map control did load and display my web map! However, all of the app's widgets disappeared.

 

How can I replace the map contents without removing the app's widgets?

Outcomes