Values returned from Arcade expressions can be referenced within the description property of a PopupTemplate. This is supported as part of the new popup Arcade profile. Similar to the visualization profile, this is useful for situations when you want to display data that isn't present as an attribute value in your FeatureLayer instance.
To view a value returned from an expression in the popup, you must reference it in the expressionInfos property of the PopupTemplate and assign it a name and a title. Then you can place the name of the expression in a placeholder (e.g. {expression/expression-name}) to be replaced by the returned value at runtime when the expression executes.
layer.setInfoTemplate(new PopupTemplate({
expressionInfos: [{
name: "participation-rate",
title: "% of population 16+ participating in the labor force",
expression: "Round(($feature.CIVLBFR_CY / $feature.POP_16UP)*100,2)"
}],
description: "In {NAME} county, {expression/participation-rate}% of the population"
+ " participates in the labor force."
}));
In the snippet above, values from the CIVLBFR_CY and POP_16UP fields are used to calculate the labor force participation rate for each county. The PopupTemplate defined above would yield the following result when the feature representing Greenlee, AZ is clicked.
See the following resources related to Arcade and popups that are new to 3.21:
This release of the JavaScript API includes a support for vector tile layer printing through client-side image. Please see to PrintTask document.
defaultVectorBasemap
, helperServices
, useVectorBasemaps
, vectorBasemapGalleryGroupQuery
on class Portal
.expressionInfos
on class PopupTemplate
.allowUpdateWithoutMValues
on class FeatureLayer
.isMapNavigation
, isPinchZoom
, isScrollWheel
on class Map
..on("style-update")
on class SymbolStyler
..on("update-end")
, .on("update-start")
on class VectorTileLayer
.getThumbnailUrl()
on class PortalUser
.getThumbnailUrl()
on class PortalItem
.getThumbnailUrl()
on class PortalGroup
.getSourceLayer()
on class Graphic
.disablePinchZoom()
, disableScrollWheel()
, enablePinchZoom()
, enableScrollWheel()
on class Map
.isMapNavigation
, isDoubleClickZoom
, isClickRecenter
, isPan
, isRubberBandZoom
, isPinchZoom
, isKeyboardNavigation
, and isScrollWheel
. ResourceInfo
object for a WMTSLayer resulted in a shift from the actual location.editor-show
, editor-hide
, and data-change
events now fire consistently.(
or ]
.Version 3.21 of the ArcGIS API for JavaScript include:
dgrid1
directory, whereas version 0.3.17 should reference the dgrid
directory.
Please refer to the dgrid 0.4 Migration Guide for additional information on migrating to the newer version.
Use the repository on GitHub for the JS API TypeScript definitions.