Hello! I'm trying to dynamically add layers to my map in a custom ExB Widget (1.5).
I've followed this to add layers: https://developers.arcgis.com/experience-builder/sample-code/widgets/add-layers/
That works in adding the layer to the map, but that's it. The layer doesn't have an associated JimuLayerView created in the JimuMapView, and also no associated data source.
I found I can call the method createJimuLayerViews() on the JimuMapView, and this creates the JimuLayerView, however, there is still no data source.
If I try to call getLayerDataSource() on the recently create JimuLayerView, it comes back undefined.
Any thoughts/ideas?
Thanks!
Alejandro
Hi Alejandro,
What other functionalities do you need besides adding the layer to the map? I've used the JimuLayerViews to identify all layers in my map and use those results to toggle the visibility of the layer I wanted. I have tried to use the same method as you did however, I don't get the results I'm looking for. If you're interested in how I did this I'll post it.
Thanks for your reply @JessicaRamirez1 . I need to add new layers to the map on the fly. And I need those layers to have proper data source (like all others in the web map) so I can manage selection.