dojo.require("esri.InfoTemplate")
Description
(Added at v1.0)
An InfoTemplate contains a title and content template string used to transform
Graphic.attributes into an HTML representation. The Dojo syntax
${}
performs the parameter substitution. In addition, a wildcard
${*}
can be used as the template string. The wildcard prints out all of the attribute's name value pairs. The default behavior on a Graphic is to show the Map's
InfoWindow after a click on the
Graphic. An InfoTemplate is required for this default behavior.
Samples
Search for
samples that use this class.
Subclasses
Constructors
Properties
Methods
Constructor Details
Creates a new empty InfoTemplate object.
Creates a new InfoTemplate object. All parameters are required and must be specified in the order given.
Sample: Use a wildcard to automatically include all the attribute's name value pairs.
var infoTemplate = new esri.InfoTemplate("Attributes", "${*}");
Display only the specified fields.
infoTemplate = new esri.InfoTemplate("Attributes", "State Name: ${STATE_NAME}<br>Population: ${Pop2001}");
Creates a new InfoTemplate object using a JSON object.
Parameters:
<Object > json |
Required |
JSON object representing the InfoTemplate. {title:"Test Title", content:"Test Content"} |
Sample:
var json = {title:"Attributes",content:"State Name: ${STATE_NAME}<br>Population: ${POP2001}"}
var infoTemplate = new esri.InfoTemplate(json);
Property Details
The template for defining how to format the content used in an
InfoWindow.
Starting with version 2.2 the content for an InfoWindow can be defined using either a string or a function. This provides the developer the ability to easily format and customize the InfoWindow contents. Prior to 2.2, only a string could be specified. View the
Format Info Window Content help topic for more details.
The template for defining how to format the title used in an
InfoWindow. You can format the title by specifying either a string value or a function. See the
content property for more details. In most cases, the title is specified as either a simple string or a function that returns a simple string. View the
Format Info Window Content help topic for more details.
Method Details
Sample:
infoTemplate.setContent("State Name: ${STATE_NAME}");
Sample:
infoTemplate.setTitle("Feature Attributes");
Converts object to its ArcGIS Server JSON representation.