We would like to change the webmap assigned to the app created using Web AppBuilder dynamically in a custom widget. And all other widgets such as "Search", "Coordinate", "OverView Map", "SclareBar", "HomeButton", "ZoomSlider" will work with out any impact. So, could anyone please direct me if there is any OOTB utility available in Web AppBuilder framework?
I am following the below procedure to implement this. Please let me know if there is any other best way.
1. Destroying current map (by..... this.map.destroy();)
2. Creating a new map with webmap id of desired webmap, using below code
var mapDeferred = jimuUtils.createWebMap("<url of portal>", "newWebmapID",
3. Publishing "mapChanged" event
4. Subscribing this event in all the widgets such as mentioned above and writing necessary code to set map object, events, to the code esri dijits
It is working some how. But I am not sure if this is the correct way. So, I would request for any best solutions.
Thanks & Regards,