I'm using Esri Javascript API 4.5
When the map loads, I'm fetching point coordinates from external source and then plotting it on the map using Graphic
class and assigning a PopupTemplate
to that graphic.
The Case
The graphic is successfully plotted on the map. But in order to view to the popup template, I'm required to click on the graphic.
The Issue
Is there way where I can trigger the graphic's click event when it gets added to the map so that the popup template shows up automatically?
The Code
require([
"esri/PopupTemplate",
"esri/Graphic",
.
.
.
.
"dojo/domReady!"
],
function (
PopupTemplate, Graphic, ....) {
var point = {
type: "point",
x: <some x>,
y: <some y>
};
var symbol = {
type: "picture-marker",
url: "/euf/assets/nl/images/red-pin.png",
width: "30px",
height: "30px"
};
var template = new PopupTemplate({
title: "New Title",
content: "New Content"
});
var graphic = new Graphic({
geometry: point,
symbol: symbol,
popupTemplate: template
});
view.graphics.add(graphic); // this works as I can see the marker on page
// now, how do I trigger its click event here?
});