A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.arcgis.com/en/javascript/jsapi/infotemplate-amd.html below:

InfoTemplate | API Reference | ArcGIS API for JavaScript 3.46

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.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.

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 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.


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