Hello,
is it possible to swap the webmap used in my WAB app for a new map at the click of a button?
The original webmap is set in the config of the app. I am trying to swap the webmap for a new one like so (following this sample code Web map by ID | ArcGIS API for JavaScript 3.30 😞
arcgisUtils.createMap("ckdklsdjksd98sdjxxxXX89", "map").then((response) => {
this.map = response.map;
});
That doesn't seems to do anything. So I tried destroying the old map before adding the new one like so:
arcgisUtils.createMap("ckdklsdjksd98sdjxxxXX89", "map").then((response) => {
this.map.destroy();
this.map = response.map;
});
It kinda work but then all my widgets are gone!
What am I missing?
I just tried with "removeAllLayers()":
arcgisUtils.createMap("ckdklsdjksd98sdjxxxXX89", "map").then((response) => {
this.map.removeAllLayers();
this.map = response.map;
});
Doesn't work either.