Hello,
I am using 4.6 version of ESRI Javascript. I have tried to do a query and get a Popup of the resulting features, which looks similar to the Popup you would get when making click on a feature. But with no success.
I have a FeatureLayer with a JSON array as source, with a popUpTemplate applied that looks as expected. I have tried to apply this popUpTemplate to the query result, but the Popup I get after the query does not properly apply the given popUpTemplate. Fields are not matched, they look literally like in the popupTemplate.
ie: showing "ID={ID}" instead of its numeric value "ID=54"
I also thought to simulate programatically a user click, using varios techniques, but none worked. I read that emit method could be a possibility in older versions, but in 4.6 does not seem to work.
This is my code:
view.whenLayerView(foundLayer_CM).then(function(lyrView) {
// query all the features available for drawing.
lyrView.queryFeatures().then(function(results) {
results.forEach(function(element) {
var idElemento = element.attributes["IDALFA"];
if (idElemento==value_IDALFA){
var screenPoint;
var screenPoint2 = view.toScreen(element.geometry, screenPoint);
var screenX = screenPoint2.x;
var screenY = screenPoint2.y;
view.popup.features = [element];
view.popup.popupTemplate = pTemplate_CM;
view.popup.title = pTemplate_CM.title;
view.popup.location = element.geometry;
view.popup.open();
}
});
});
});