Need to put a link in an infoTemplate's content

991
3
Jump to solution
06-10-2013 09:40 AM
TyroneLigon
Occasional Contributor
Apologizing in advance for not being able to post code...

Using the "Geoprocessing tool link in popup" example, I need to put the "Population" link in an infoTemplate's content instead of the infoWindow. The link will execute a function that draws connection lines between certain markers on the map, but only for one particular type of map marker that contains the info needed to draw the lines, so I don't want to add the link to the infoWindow itself.

The "dojo.query" statement in the example adds the link object to a class in the infoWindow's domNode...is there another class I can use to add it to the content instead?
0 Kudos
1 Solution

Accepted Solutions
TracySchloss
Frequent Contributor
I have been using a function to set the content of my infoWindows.  It gave me a lot more control over the content.  You could include code to check for certain conditions, run other functions etc.

   parcelInfoTemplate = new esri.InfoTemplate();    parcelInfoTemplate.setTitle("Parcel Information");    parcelInfoTemplate.setContent(parcelSetWindowContent);


Then you function would run when you clicked on an element.  I have mine set to format the contents as a table. You could easily add some HTML code for a hyperlink instead.

function parcelSetWindowContent(graphic){
//your code would go here that executes when you click
}

View solution in original post

0 Kudos
3 Replies
TracySchloss
Frequent Contributor
I have been using a function to set the content of my infoWindows.  It gave me a lot more control over the content.  You could include code to check for certain conditions, run other functions etc.

   parcelInfoTemplate = new esri.InfoTemplate();    parcelInfoTemplate.setTitle("Parcel Information");    parcelInfoTemplate.setContent(parcelSetWindowContent);


Then you function would run when you clicked on an element.  I have mine set to format the contents as a table. You could easily add some HTML code for a hyperlink instead.

function parcelSetWindowContent(graphic){
//your code would go here that executes when you click
}
0 Kudos
VinayBansal
Occasional Contributor II
You can use this sample to add your content to infoTemplate

http://developers.arcgis.com/en/javascript/jssamples/util_project.html
0 Kudos
TyroneLigon
Occasional Contributor
Wish I had a way to give both answers credit because I used elements from both for my final solution. My solution was to define standard content for the popup, and create button HTML with an onclick method pointing to my marker linkage function. If I needed the button to display linkages between markers, I add the button to the popup content.

I'm going to open a separate thread for the next challenge - the app relies heavily on jQuery, so I need to figure out how to embed a jQuery button in the info template's content.
0 Kudos