Hi all,
I'm very new to experience builder. I've created a custom widget that when the user presses a button, adds a layer hosted on my ArcGIS Online. However, after adding the layer, despite being able to see it displayed on the map, I am unable to select / edit it using the select / editor tools. Is there some specific property I need to enable when I add the layer to enable selection / editing?
I can't add the layer in as a datasource on the map beforehand, since I plan on adding functionality to create and add custom layers based on user input.
Solved! Go to Solution.
Hi Jeffrey, thank you so much! This repo has a lot of valuable examples. I realized that the issue was that while I was creating a data source, I was adding the layers to my map via: jmv.view.add(layer). When I added the layer via jmv.addLayerAndCreateJimuLayerView(layer, datasource), I was able to select and edit.
Thank you for providing your add/remove layer tool - I was only able to notice this after looking through your code.
In order to get a layer to work with many of the built-in Widgets including Select and Edit, the layer must be converted to a Experience Builder Datasource. Here is the official example: https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/widgets/data-source-widg...
Here is a completed widget designed for adding layers as Datasources: https://community.esri.com/t5/experience-builder-custom-widgets/add-remove-layers-3-0-full-settings-...
Hi Jeffrey, thank you so much! This repo has a lot of valuable examples. I realized that the issue was that while I was creating a data source, I was adding the layers to my map via: jmv.view.add(layer). When I added the layer via jmv.addLayerAndCreateJimuLayerView(layer, datasource), I was able to select and edit.
Thank you for providing your add/remove layer tool - I was only able to notice this after looking through your code.