Is there a way to programmatically display a popup as if the location marker (graphic) was clicked?
I want to use an ActionToggle to display and/or hide some additional content in the popup. Everything is good except for me knowing what to call to redisplay the default incarnation of the popup.
As an example, suppose I am mapping ice cream shops and the default popup displays a name, address, and phone number. I define the popup template like this:
const store_popup = {
title: "{name}",
content: "<p>{address}</p>" + "<p>{phone}</p> </div>",
actions: [flavorsToggle]
};
For the popup, I have an ActionToggle to display specialty flavors of ice cream available at the shop (in an HTML table). I might have one function to display the extra information using view.popup.content:
showFlavors() {
return view.popup.content =
"<div class='esri-feature-content'>"
+ "<p>" + view.popup.selectedFeature.attributes.address
+ "<p>" + view.popup.selectedFeature.attributes.phone
+ "<table>"
+ view.popup.selectedFeature.attributes.flavors
+ "</table>"
+ "</div>";
}
When I write the code for the companion hideFlavors() function, I want to call the popup in its default form -- as it is defined by the popup template. Is there a way to do that?