FieldInfo 数组,用于定义数据集中的字段或 Arcade 表达式中的值如何参与弹出窗口。如果未指定FieldInfo,则不会显示任何内容,因为弹出窗口将仅显示此数组定义的字段。每个 FieldInfo 包含单个字段或表达式的属性。此属性可以直接在 PopupTemplate 或 fields content element 内设置。如果这没有在 fields content element 中设置,它将默认为直接在
PopupTemplate.fieldInfos
中指定的任何内容。左边的图像是使用下面第一个示例片段的结果,而右边的图像是第二个片段的结果。使用此
fieldInfos
属性为图表或文本元素中显示的数字指定任何格式选项。使用 'fields' 类型设置的内容 从 fieldInfo 中设置的字段引用的内容 例子:
// This snippet demonstrates how to show only a subset of fields. // By setting the 'type: "fields"', and providing the fieldInfos, // only field data will display within this feature layer's popuptemplate. // If no fieldInfos is specified directly in the content, the popup defaults // to whatever is set in the popupTemplate.fieldInfos. let popupTemplate = new PopupTemplate({ // autocasts as new PopupTemplate() title: "{NAME} in {COUNTY}", outFields: ["*"], content: [{ // It is also possible to set the fieldInfos outside of the content // directly in the popupTemplate. If no fieldInfos is specifically set // in the content, it defaults to whatever may be set within the popupTemplate. type: "fields", fieldInfos: [{ fieldName: "B12001_calc_pctMarriedE", label: "Married %" },{ fieldName: "B12001_calc_numMarriedE", label: "People Married", format: { digitSeparator: true, places: 0 } }] }] });
// This snippet demonstrates setting the popup's content by referencing // specific fields defined within the popupTemplate's fieldInfos. let popupTemplate = new PopupTemplate({ title: "{NAME} in {COUNTY}", outFields: ["*"], content: "Census data indicates that {B12001_calc_numMarriedE} people were married in {NAME}, {COUNTY}. The overall percentage of married people is {B12001_calc_pctMarriedE}%.", fieldInfos: [{ fieldName: "B12001_calc_pctMarriedE", },{ fieldName: 'B12001_calc_numMarriedE', format: { places: 0, digitSeparator: true } }] });
基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/PopupTemplate"], (PopupTemplate) => { /* code goes here */ });
ESM:
import PopupTemplate from "@arcgis/core/PopupTemplate";
类:
esri/PopupTemplate
继承: PopupTemplate > Accessor
自从:用于 JavaScript 4.0 的 ArcGIS API
用法说明
PopupTemplate.fieldInfos
函数(或属性)的定义如下:
相关用法
- JavaScript ArcGIS PopupTemplate.returnGeometry用法及代码示例
- JavaScript ArcGIS PopupTemplate.expressionInfos用法及代码示例
- JavaScript ArcGIS PopupTemplate.actions用法及代码示例
- JavaScript ArcGIS PopupTemplate.content用法及代码示例
- JavaScript ArcGIS PopupTemplate.title用法及代码示例
- JavaScript ArcGIS PopupTemplate.overwriteActions用法及代码示例
- JavaScript ArcGIS PopupTemplate.outFields用法及代码示例
- JavaScript ArcGIS PopupTemplate用法及代码示例
- JavaScript Popup.autoOpenEnabled用法及代码示例
- JavaScript Popup.location用法及代码示例
- JavaScript Popup.headingLevel用法及代码示例
- JavaScript Popup trigger-action事件用法及代码示例
- JavaScript Popup.features用法及代码示例
- JavaScript Popup.content用法及代码示例
- JavaScript Popup.alignment用法及代码示例
- JavaScript Popup.title用法及代码示例
- JavaScript Popup.classes用法及代码示例
- JavaScript Popup.when用法及代码示例
- JavaScript Popup.visibleElements用法及代码示例
- JavaScript Popup.actions用法及代码示例
- JavaScript Popup.open用法及代码示例
- JavaScript Popup.fetchFeatures用法及代码示例
- JavaScript Popup.dockEnabled用法及代码示例
- JavaScript Popup.on用法及代码示例
- JavaScript Popup.goToOverride用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 PopupTemplate.fieldInfos。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。