require(["esri/dijit/PopupTemplate"], function(PopupTemplate) { /* code goes here */ });Description
(Added at v2.3)
The PopupTemplate class extends
esri/InfoTemplate
and provides support for defining a layout. It can contain the following components:
These components are organized in a layout that is identical to the popup experience in ArcGIS.com
View the Working with Popups help topic for details on creating and using popups.
SamplesSearch for
samplesthat use this class.
Class hierarchyesri/dijit/InfoTemplate |_esri/dijit/PopupTemplateConstructors CSS
esri/dijit/PopupTemplate | Download source
Properties MethodsConstructor Details
Create a new PopupTemplate object.
Parameters: <Object
> popupInfo Required An object that defines popup content. Field names can be used in the content by specifying the field name in curly brackets, for example {description}
. View the Popup Content help topic for information on the object properties. <Object
> options Optional Optional parameters. See options list for details. options
properties: <Number
> utcOffset Optional Positive or negative offset (in minutes) from UTC. If specified, date fields in the popup will be formatted in the time zone represented by the offset. Positive value indicates offset to the west of UTC, negative otherwise. If offset is not specified, date fields will be formatted in the user's local time zone. Sample:
require([ "esri/dijit/PopupTemplate", ... ], function(PopupTemplate, ... ) { var template = new PopupTemplate({ title: "Age Distribution in {FIPS}", fieldInfos: [ { fieldName: "AGE_UNDER5", visible: true, format: { places: 0 } }, { fieldName: "AGE_5_17", visible: true, format: { places: 0 } }, { fieldName: "AGE_18_21", visible: true, format: { places: 0 } }, { fieldName: "AGE_22_29", visible: true, format: { places: 0 } }, { fieldName: "AGE_30_39", visible: true, format: { places: 0 } }, { fieldName: "AGE_40_49", visible: true, format: { places: 0 } }, { fieldName: "AGE_50_64", visible: true, format: { places: 0 } }, { fieldName: "AGE_65_UP", visible: true, format: { places: 0 } } ], mediaInfos: [ { type: "piechart", value: { fields: [ "AGE_UNDER5", "AGE_5_17", "AGE_18_21", "AGE_22_29", "AGE_30_39", "AGE_40_49", "AGE_50_64", "AGE_65_UP" ] } } ] )}; ... });
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 popup definition defined as a JavaScript object.
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