I am trying to use the new Features widget to have the popup info posted on the side panel.
There is an example at
https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=widgets-features
that it uses a featurelayer from the portal.
Below, I modified the above example by removing the webmap and added a feature layer. But I can't see the popup info if you click on a feature. What am I missing? Thank you.
https://codepen.io/lkoumis1/pen/BaGwrde?editors=1000
Hi @LefterisKoumis -
When you want to use the fetchFeatures method, the layers need to have an associated popupTemplate set. This is noted in the description of the method.
If you add a popup template to your feature layer, the features are fetched successfully:
const featureLayer = new FeatureLayer({ url: "https://gis.cnra.ca.gov/arcgis/rest/services/Boundaries/CCED_AccessType/MapServer/0", popupTemplate: { title: "Title", content: "This is the content." } });
Hope this helps!
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.