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
Solved! Go to Solution.
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!
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!