How can I get the result, so that I can use the result data. I cannot see any event related to the query nor the popup object to get the result. I am using js ver 4.2 btw.
You should be able to get the query feature with view.popup.features and then iterate through the features returned to get the attributes.
But how to trigger the callback function? How do I know when the query request has completed ?
Event handler?
view.popup.on("open", function(evt){
// code
});
Hi Basson, thanks for the quick reply but your code didnot help.
The event 'open' doesnot fire..
Sorry, no time to test.
I tried to add a popup template for the layer like
var popupTemplate = new PopupTemplate({
title: "Régions Industrielles 2017: {NOM}",
content: setContentInfo
});
function setContentInfo(feature){
console.log(feature)
return "?? no idea what the original template is....";
}
//later added this template to the layer
lyr.popupTemplate = popupTemplate;
Now I can access the query feature, but now I do not know the 'content' template for the popup.
Hello there, here comes an example :
var myTitle = "Hello";
var sum1 ="there";
var point = feature.attributes.geometry;
var content = `<div style=padding-top: 10px;>Title: ${myTitle}<br /></div>
<div style=padding-top: 10px;>Sum1: ${sum1}<br /></div>`;
map.infoWindow.resize(450, 250);
map.infoWindow.setContent(esri.substitute(esri.geometry.webMercatorToGeographic(point), content));
Also, there is no event 'open' for the view.popup @ api reference Popup | API Reference | ArcGIS API for JavaScript 4.2