Select to view content in your preferred language

View.popup.open not working

1726
1
Jump to solution
04-21-2022 11:58 PM
YogeshSwami
New Contributor II
Hello
I am trying to open popup using view.popup.open by querying through the sample code given below.
 
layer.when(()=>{
                    layer.queryFeatures().then((results: any) => {
                        const features = results.features;
                        features.forEach((result: any) => {
                            const oid = result.attributes.OBJECTID;
                            if (oid == this.id) {
                                console.log(result);
                                view.popup.open({
                                    features: result,
                                    location: result.geometry.centroid,
                                    fetchFeatures: true,
                                    shouldFocus: true,
                                });
                            }
                        });
                    });
                })
 
In this console statement I am getting the exact feature I want but view.popup.open is not showing the popup. Can anyone please help me with this?
Thanks in advance.
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

The features property is expecting an array. Try putting result in brackets

 

features: [result]

 

View solution in original post

1 Reply
KenBuja
MVP Esteemed Contributor

The features property is expecting an array. Try putting result in brackets

 

features: [result]