When I select a point on the map, a popup window opens that shows information, but I need to capture that information that the popUp shows
Reading the documentation of arcgis javaScript I found this method, but it does not work for me to obtain the popUp data:
view.on("click", function (event) {
view.hitTest(event).then(function (response) {
if (response.results.length) {
let graphic = response.results.filter(function (result) {
// check if the graphic belongs to the layer of interest
return result.graphic.layer;
})[0].graphic;
// do something with the result graphic
console.log(graphic.attributes);
}
});
});
Solved! Go to Solution.
You don't need to listen to any events, you can watch for the popup.selectedFeature property to change
view.popup.watch("selectedFeature", (feature) => {
// do something
})
You don't need to listen to any events, you can watch for the popup.selectedFeature property to change
view.popup.watch("selectedFeature", (feature) => {
// do something
})
Thanks for your help, it helped me