Popup Async

402
1
06-06-2022 12:03 PM
VikKrishna
New Contributor

Hello,

          I am looking to run async query methed on map click, and show results in a popup along with other visible features.  I am running that query method as below.

Sometimes query results shows up in popup, and sometime doesn't and only the map feature layer results shows up in popup. Not sure how to add a query method before popup renders.

 

 

mapView.on("click",(evt) => {
    const query_promise = getFeatures(evt.mapPoint,1,"feet",working_region);
    query_promise.then((e:Graphic[]) =>{
        if(e.length){
            mapView.popup.features.push(e[0]);
        }
    });
})

 

Tags (3)
0 Kudos
1 Reply
RobertMEIER
Occasional Contributor

You could set the content property of your popup to a function as described here:

https://developers.arcgis.com/javascript/latest/sample-code/popuptemplate-promise/

 

0 Kudos