AnsweredAssumed Answered

How to get points created using PointBuilder QML Type to listen to click events?

Question asked by kcheriyan_geomarvel on Oct 10, 2019
Latest reply on Oct 11, 2019 by ESoekianto-esristaff

I'm trying to create a feature for my app in AppStudio 4 where if the user clicks on one of the points on the given map, the map extent and zoom will change to center the selected point. I can't figure out how to do this. Here's my code and explanations:


I'm pulling the coordinates with a http request remotely. As the data gets updated, the points will update themselves. I was able to get this working fine. Inside my http request, for each data record, I use PointBuilder to create points and graphics on the map. See below:


var sr = ArcGISRuntimeEnvironment.createObject("SpatialReference", { wkid: 4326 });
var pointBuilder = ArcGISRuntimeEnvironment.createObject("PointBuilder");
pointBuilder.spatialReference = sr;
var geom = pointBuilder.geometry;
if (geom) {
         var graphic = ArcGISRuntimeEnvironment.createObject("Graphic", { geometry: geom });;


record refers to each data point I'm pulling with the http request.

This works fine and I'm able to view my points on the map. But now, I want to click or tap on the point graphic and have it respond, for instance by centering the map on the selected point. Seems like pretty basic map-component interaction behavior. But I can't find much documentation on this. How can I go about doing this? 


Any ideas appreciated. Thanks!