Hi, I have a map with multiple points, when i click on a point i get a pointInfoTemplate popup. I'm experimenting with adding my own hyperlink into this popup. So far, i've only been able to add the hyperlink into the title area which says 'click me'. I would like to add the hyperlink below the header, somewhere in the content pane, is that possible? If so, what could should i use? I've copied the snippet below.
thanks
for each (var item in apiData.items) {
var x = item.geometry.x; var y = item.geometry.y; var point = new Point(x, y, spatial); var pointAttributes = { Location: "item.attributes.LOCATION", Type: "item.attributes.BinType" }; var pointInfoTemplate = new InfoTemplate("item.attributes.LOCATION<br/><a class='clickMe' href='#' onclick='alert(item.geometry.x + \", \" + item.geometry.y);return false'>click me</a>"); var pointGraphic = new Graphic(point, pictureSymbol, pointAttributes, pointInfoTemplate); map.graphics.add(pointGraphic);
}
Solved! Go to Solution.
Scott,
In your code the only thing you are specifying in the InfoTemplate constructor is the title. That is why your link is appearing in the title.
var pointInfoTemplate = new InfoTemplate("item.attributes.LOCATION<br/><a class='clickMe' href='#' onclick='alert(item.geometry.x + \", \" + item.geometry.y);return false'>click me</a>");
If you add a second string parameter in the constructor then you will be specifying the templates actual content.
https://developers.arcgis.com/javascript/3/jsapi/infotemplate-amd.html#infotemplate2
Scott,
In your code the only thing you are specifying in the InfoTemplate constructor is the title. That is why your link is appearing in the title.
var pointInfoTemplate = new InfoTemplate("item.attributes.LOCATION<br/><a class='clickMe' href='#' onclick='alert(item.geometry.x + \", \" + item.geometry.y);return false'>click me</a>");
If you add a second string parameter in the constructor then you will be specifying the templates actual content.
https://developers.arcgis.com/javascript/3/jsapi/infotemplate-amd.html#infotemplate2
Thanks Robert, i've managed to get it working.