Select to view content in your preferred language

Point popup hyperlink

797
2
Jump to solution
12-02-2019 09:34 AM
ScottWilson2
Emerging Contributor

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);
}
Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

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 

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

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 

ScottWilson2
Emerging Contributor

Thanks Robert, i've managed to get it working.

0 Kudos