Is there a way to add an event on a popup open event? I want, based on its target, to perform a AJAX call and retrieve more data to populate the content field from a third party system.
Popup only has the "trigger-action" event that handles action within the popup.
Lars,
There are actually very few events in the 4.x api. You now just watch properties.
https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Popup.html#visible
Use view.popup.watch("visible", function(){});
Thank you Robert, this is what I was looking for.
I was getting doubled results when the pop up was turned on and off, so I added an if statement
view.popup.watch("visible", function (popUpStatusChange) {
if (popUpStatusChange == true) {
console.log("Pop-up watch has been fired")
console.log("Pop-up title is:", view.popup.title); //returns the pop up title
console.log("Pop-up content is:", view.popup.content); //returns the pop up content
}
});
GitHub - guzhongren/AGS-JS-API-Popup: 自定义基于AGS的弹出框,用于解决鼠标在graphic上点击或移动时候自动弹出popup或者自定义popup内容的特殊效果 ;
if you neet to do something special, you can ref this