Select to view content in your preferred language

URL in popuptemplate

1114
2
01-20-2014 03:54 PM
PatrickBell
New Contributor
Hi there,

I'm quite new to ArcGIS and I'm including the javascript API within a .net application. My question is, inside the popuptemplate - can you add a URL?

For example - somthing like this:

fieldInfos: [{
                   fieldName: "Name",
      label: 'Name:',
      visible: true,
      url: "url here"    }


Any help would be greatly appreciated 🙂
0 Kudos
2 Replies
KaitlynnDavis
Regular Contributor
I don't think there's a property in the popup template for adding URLS. There's another class though called infoTemplate that gives you the ability to modify the inner html of the popup (https://developers.arcgis.com/en/javascript/jsapi/infotemplate.html). Here's an example:

var infoTemplate = new InfoTemplate();
infoTemplate.setTitle("My Info Window");
infoTemplate.setContent( "<b>Field One:</b>${FIELD_ONE}<br/>"
                  + "<b>Field Two: </b>${FIELD TWO}<br/><br/>"
                  + "<b>Field Three: </b>${FIELD_THREE}<br/>"
                  + "<b>Field Four:</b><a id= 'myClick' style='cursor:pointer;' href='https://developers.arcgis.com/en/javascript/'>ArcGIS JavaScript Docs</a>"
);


If you have a function that is generating the URLS you could set the anchor element's onclick event to that function
0 Kudos
PatrickBell
New Contributor
InfoTemplate = exactly what I was looking for 🙂

Thanks a bunch!
0 Kudos