AnsweredAssumed Answered

ArcGIS Javascript API v3.21 : I can't display the content of InfoTemplate using deferred object when I am clicking on a Graphic

Question asked by kostaspapakon on Aug 23, 2017
Latest reply on Aug 30, 2017 by kostaspapakon

Hello,

 

I use "arcgis for javascript 3.21" and I have created a map with some graphics (points). The problem is that I can't display the content of infowindow because I get an error message.

 

...

var getPopupTemplate = function(target) {
    var towerId = target.attributes.id;

    var requestObj = {
   url: "http://...",
   content: {
      ...
   },
   handleAs: "json"
};
var markerInfoResponseSuccess = function(response) {
console.log(response);
var markerInfo = response.markerInfo;
var html = "<a href=" + markerInfo.url + ">" + markerInfo.title + "</a>";

return html;
};

var markerInfoResponseError = function(error){
console.log("There was an error on 'get marker info' request: ", error);
};

return esriRequest(requestObj).then(
markerInfoResponseSuccess,
markerInfoResponseError
);
};
var pt = new InfoTemplate({
    content: getPopupTemplate
});
var markerSymbol = new PictureMarkerSymbol({
    "url"   : "http://...",
    "width" : 10,
    "height": 10
});
var point = new Point({
    longitude: ...,
    latitude: ...
});

var pointAtt = {
    title: "myTitile",
    id: 100
};

// Create a graphic and add the point geometry and pin(symbol) to it
var pointGraphic = new Graphic( point, markerSymbol, pointAtt, pt);

....

 

When I click on the point I can see the response on console but I get the following error, and the content on the infowindow is empty. If I use :

 

var pt = new InfoTemplate({
    content: "my text"
});

then everything is OK. What's the problem?

TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at Object.b.place (init.js:208)
    at Object.place (init.js:1184)
    at Object.setContent (init.js:1149)
    at Object._updateWindow (init.js:1157)
    at Object._featureSelected (init.js:1157)
    at Object.<anonymous> (init.js:63)
    at Object.c [as onSelectionChange] (init.js:119)
    at Object.select (init.js:1191)
    at Object._updateFeatures (init.js:1197)
    at init.js:62 "TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
    at Object.b.place (https://js.arcgis.com/3.21/init.js:208:402)
    at Object.place (https://js.arcgis.com/3.21/init.js:1184:263)
    at Object.setContent (https://js.arcgis.com/3.21/init.js:1149:278)
    at Object._updateWindow (https://js.arcgis.com/3.21/init.js:1157:500)
    at Object._featureSelected (https://js.arcgis.com/3.21/init.js:1157:254)
    at Object.<anonymous> (https://js.arcgis.com/3.21/init.js:63:277)
    at Object.c [as onSelectionChange] (https://js.arcgis.com/3.21/init.js:119:193)
    at Object.select (https://js.arcgis.com/3.21/init.js:1191:258)
    at Object._updateFeatures (https://js.arcgis.com/3.21/init.js:1197:246)
    at https://js.arcgis.com/3.21/init.js:62:468"

 

thank you,

Kostas

Outcomes