Hello, new to the arcgis dev. My question is how to get all base maps and operational layers with a button click on a widget? the button click should capture all map and layers that are currently existing in the application when button click is triggered. Please share the codes. Thanks,
Solved! Go to Solution.
Alex,
You can use the LayerInfos class in WAB:
LayerInfos class—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
There is a code snippet in the above doc page.
Alex,
You can use the LayerInfos class in WAB:
LayerInfos class—Web AppBuilder for ArcGIS (Developer Edition) | ArcGIS for Developers
There is a code snippet in the above doc page.
Always thank you for your replies, Robert.
just confirm: is LayerInfos.getInstance(this.map, this.map.itemInfo) able to catch all layers (base map tiles, graphics, feature layer, and any dynamic layers added by users)?
Alex,
Yes. Use getBasemapLayers function to get basemaps and getLayerInfoArray for all operational Layers