AnsweredAssumed Answered

displaying infotemplate on query

Question asked by petergondi on Mar 19, 2018
Latest reply on Mar 20, 2018 by TGrant-esristaff

how can i display an infotemplate while zooming to a point on a map after doing a query on a feature layer using a result stored in local storage

var terminal= localStorage.getItem('terminal');
var info= new InfoTemplate({title:"Name"});
var queryTask = new QueryTask("https://services1.arcgis.com/Kw7jGaBPiN3WUAmT/ArcGIS/rest/services/ID_Terminals1a/FeatureServer/0",{mode:FeatureLayer.MODE_ONDEMAND,
infoTemplate:info,
outFields:["Name"]
});

var query = new Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.where = "Name = '" + terminal + "'";
queryTask.execute(query, showResults);

function showResults(results) {
var resultCount = results.features.length;
for (var i = 0; i < resultCount; i++) {
//Zoom to line extent
var geom = results.features[i].geometry;
//geom.setInfoTemplate(info);
//Zoom to line extent

map.centerAndZoom(geom, 19);


}
}

the query zooms to the point fetched from the local storage but does not display the infotemplate

Outcomes