Hi Team,
We have a requirement to switch web maps of a single Map Widget dynamically. We have this option in Experience Builder dev edition, but that is limited to 2 web maps. We have a list of webmaps shown in a custom widget, upon selection/click, the web map of the map widget should be changed to selected one. At the same time, the layers from the active/selected web map should have the complete data actions (eg., Add To Table) in Map Layers widget.
We are using Exp Builder Dev edition 1.16
Any help would be highly appreciated
With Regards,
Vara Prasad
Possibly instead of building a custom widget at all, you could use a Section Widget to change Map Widgets.
https://doc.arcgis.com/en/experience-builder/latest/configure-widgets/section-widget.htm
I don't know if there is a simpler solution to change out the entire map at once, but it is possible to switch out all the layers and register them as datasources. Take a look at this thread for code for making a Feature Layer into a datasource.
Thank you very much for your reply. We have 100s of layers in a web map and we have many such web maps. So, clearing all layers and adding those many number of layers and registering them as datasources.
I thought it would be simple to switch web maps, just like the way, Exp Builder provides switch for 2 web maps as OOTB. Any pointers in this direction?
Thanks in advance!
With Regards.
I would look into using a Section Widget with Lazy Loading Views.
The code linked above could be used in a loop to switch many layers at once.
Practically, you may need to evaluate your goals for this application. It may be technically possible to build it, but the demand on your servers and the end-users computer is going to be very high.
Hi @JeffreyThompson2 ,
Correct, the above linked code worked. Any simple approach for this please. Also, rethinking on the application goals. Could you please elaborate on Section Widget with Lazy Loading Views.
Thank you so much
The Section Widget is a built-in widget that allows you to create mini-pages, called Views, within your Page. You can put multiple Map Widgets within the same Section Widget on different Views and set up a View Navigation Widget or a series of Button Widgets to switch between your maps. The Views have an option called Lazy Loading. Using this will prevent the View from loading into memory before the end-user requests it.
Thanks @JeffreyThompson2.
I have many other widgets which would use the jimuMapView and when a new web map is loaded, all other widgets should work with this new jimuMapView. Sections & Views will fulfill this?
Thank you so much for your continuous support
Many widgets are configured to work with datasources, not maps, and can be set up for many different datasources. Actions can target multiple Map Widgets at once.
It is also possible for a View to contain multiple Widgets or to change multiple Sections at once, so you could also consider having your Widgets change to match the Maps.