require(["esri/InfoTemplate"], function(InfoTemplate) { /* code goes here */ });Description
(Added at v1.0)
An InfoTemplate contains a title and content template string used to transform
Graphic.attributesinto 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
InfoWindowafter a click on the Graphic. An InfoTemplate is required for this default behavior.
SamplesSearch for
samplesthat use this class.
Subclasses Constructors Properties MethodsConstructor 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.
require([ "esri/InfoTemplate", ... ], function(InfoTemplate, ... ) { var infoTemplate = new InfoTemplate("Attributes", "${*}"); ... });
Display only the specified fields.
require([ "esri/InfoTemplate", ... ], function(InfoTemplate, ... ) { var infoTemplate = new 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:
require([ "esri/InfoTemplate", ... ], function(InfoTemplate, ... ) { var json = {title:"Attributes",content:"State Name: ${STATE_NAME}<br>Population: ${POP2001}"} var infoTemplate = new 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 Contenthelp 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
contentproperty 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 Contenthelp 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4