getEffectivePopupTemplate not working?

94
2
Jump to solution
05-19-2022 04:29 PM
LefterisKoumis
Regular Contributor

The graphicTemplate retuns null even though there is a graphic on click. Does the getEffectivePopupTemplate works?

view.on("click", function(event) {
        view.hitTest(event).then(function(event) {
         var graphic = event.results[0].graphic;
         console.log(graphic)
         if (graphic){
         const graphicTemplate = graphic.getEffectivePopupTemplate()
         console.log(graphicTemplate)
         }

 

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LefterisKoumis
Regular Contributor

Thank you. I found the issue. I was calling an initialization function with view popup.close().

View solution in original post

0 Kudos
2 Replies
ReneRubalcava
Frequent Contributor II

Does the graphic or source layer have a popupTemplate defined? If not, pass true to the method to try and have one created for you.

https://developers.arcgis.com/javascript/latest/api-reference/esri-Graphic.html#getEffectivePopupTem...

 

Whether support for default popup templates is enabled. When true, a default popup template may be created automatically if neither the graphic nor its layer have a popup template defined.

0 Kudos
LefterisKoumis
Regular Contributor

Thank you. I found the issue. I was calling an initialization function with view popup.close().

0 Kudos