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。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。