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)
}
Solved! Go to Solution.
Thank you. I found the issue. I was calling an initialization function with view popup.close().
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.
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.
Thank you. I found the issue. I was calling an initialization function with view popup.close().