What does popuptemplate do in ArcGIS for JavaScript?

What does popuptemplate do in ArcGIS for JavaScript?

Since: ArcGIS API for JavaScript 4.0 A PopupTemplate formats and defines the content of a Popup for a specific Layer or Graphic. A PopupTemplate allows the user to access values from feature attributes and values returned from Arcade expressions when a feature in the view is selected.

How are field names defined in popuptemplate JavaScript?

An array of FieldInfo that defines how fields in the dataset or values from Arcade expressions participate in a popup. Indicates whether or not editor tracking should display. Additional options that can be defined for the popup layer. An array of field names used in the PopupTemplate.

Where do I find ZIP code in popuptemplate?

In the image above, the initial text Marriage in NY, Zip Code: 11358 is set in the title property of the PopupTemplate where ZIP is the name of the field containing zip codes. The rest of the content is defined in the content property where NEVMARR_CY, MARRIED_CY, and DIVORCD_CY are all field names that contain values to be used in the popup.

How to use the ArcGIS API for JavaScript?

Since: ArcGIS API for JavaScript 4.0. A PopupTemplate formats and defines the content of a Popup for a specific Layer or Graphic. A PopupTemplate allows the user to access values from feature attributes and values returned from Arcade expressions when a feature in the view is selected. The PopupTemplate contains title and content properties

How to format the content of a popuptemplate?

This sample demonstrates how to format the content of a PopupTemplate by setting the fieldInfos of the PopupTemplate in addition to a custom function. When the application starts, the popupTemplate object is initialized and the layer’s popupTemplate property is set as shown below.

What can I do with actions in popuptemplate?

Actions may also be added to the template to give users the ability to perform actions related to the feature, such as zooming to it or performing a Query based on the feature’s location or attributes.

What is the default behavior of the popuptemplate?

The PopupTemplate contains title and content properties that act as a template used to transform a feature’s attributes into an HTML representation. The syntax {fieldName} or {expression/expressionName} performs parameter substitution. The default behavior on a Graphic is to show the view’s Popup after a click on the Graphic.

How to zoom out in popuptemplate in JavaScript?

For example, if you would like to add a zoom-out action to the PopupTemplate that zooms the view out several LODs, you would define the zoom-out code in a separate function. Then you would call the custom zoom-out function in the trigger-action event handler. See the sample code snippet below for more details on how this works.

How to create a popuptemplate object in JavaScript?

Your JavaScript should look similar to what is shown below: 2. Create a PopupTemplate object and add a title The PopupTemplate allows you to show feature attributes, or data specific to the selected feature (such as region name, population, state code, etc.), inside both the title and content properties of the popup.

How does popuptemplate improve interactivity of custom applications?

They enhance the interactivity of custom applications by allowing users to click on features in the map to view content specific to the selected feature. Each view has a popup associated with it. In most cases, the content of the popup is set with a template specific to your data.

How to create an empty infotemplate object in ArcGIS?

Converts object to its ArcGIS Server JSON representation. Creates a new empty InfoTemplate object. Creates a new InfoTemplate object. All parameters are required and must be specified in the order given. The template for defining how to format the title used in an InfoWindow.

What do you do with infotemplate in JavaScript?

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.

What does a popup widget do in JavaScript?

Inheritance: Popup Widget Accessor Since: ArcGIS API for JavaScript 4.0 The popup widget allows users to view content from feature attributes. Popups enhance web applications by providing users with a simple way to interact with and view attributes in a layer.