How to add Basemap Toggle widget

841
2
12-17-2020 01:56 AM
GerardMartin
Occasional Contributor

I have a Web App Builder App in Portal using several ESRI widgets. I would like to use Basemap Toggle widget [1] that it is not contained in WAB. How should i do it? Thank you!

[1] https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-BasemapToggle.html

 

0 Kudos
2 Replies
shaylavi
Esri Contributor

Hello,

The link you added refers to the Javascript API version 4.x.

WAB is based on a different technology - Javascript API version 3.x.

There's already a Basemap toggle widget for the WAB and it's part of it as explained here: https://doc.arcgis.com/en/web-appbuilder/create-apps/widget-basemap.htm

If you'd like to build a new Basemap widget using the javascript API (which would be practically the same so I'm not sure why would you want that), the right link to create that code would be: https://developers.arcgis.com/javascript/3/jssamples/widget_basemap.html

 

Shay.

 

Shay
0 Kudos
Nicole_Ueberschär
Esri Regular Contributor

Hi Shaylavi,

I know this is an old thread but I am looking for the same. The advantage of the Basemap toggle widget is that I only toggle between two basemaps instead of opening the pane of different basemaps (even if it contains only two) and then select the other one that is not just used.

This would be the appropriate API reference: https://developers.arcgis.com/javascript/3/jssamples/widget_toggle.html

0 Kudos