Book Image

Mastering ArcGIS Server Development with JavaScript

By : Raymond Kenneth Doman
Book Image

Mastering ArcGIS Server Development with JavaScript

By: Raymond Kenneth Doman

Overview of this book

Table of Contents (18 chapters)
Mastering ArcGIS Server Development with JavaScript
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

InfoTemplates


InfoTemplates, as we mentioned in Chapter 1, Your First Mapping Application, describe how you want to display data in a popup. The InfoTemplate can be constructed using two strings, the title and the content. The title and content strings represent HTML templates, and you can substitute graphic attributes in the template. For a graphic's infoTemplate, if you wanted to display the graphic's total attribute, you would insert the value in the template with a ${total}, which shows the field name inserted inside the brackets of the substitution string ${}.

If you want to display a popup containing all the name/value pairs in the graphic's attributes, you can use a wildcard ${*} in the content value, as follows:

graphic.infoTemplate = new InfoTemplate("Attributes", "${*}");

For the content, you can add HTML content to the string, including tables, lists, images, and links. For example, you might use something like the following to describe a marine habitat:

graphic.infoTemplate = new...