當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


JavaScript ArcGIS FieldElement用法及代碼示例

基本信息

以下是所在類或對象的基本信息。

AMD: require(["esri/form/elements/FieldElement"], (FieldElement) => { /* code goes here */ });

ESM: import FieldElement from "@arcgis/core/form/elements/FieldElement";

類: esri/form/elements/FieldElement

繼承: FieldElement > Element > Accessor

自從:用於 JavaScript 4.16 的 ArcGIS API

用法說明

FieldElement 表單元素定義要素圖層的 field 如何參與 FeatureForm 。這是在 feature form'sfeature layer's formTemplate 中設置字段配置的推薦方法。

form template field elements

例子:

// Create the field element
const fieldElement1 = new FieldElement({
  fieldName: "inspector",
  label: "Inspector name"
});

const fieldElement2 = new FieldElement({
  fieldName: "inspdate",
  label: "Inspection date",
  description: "Date inspection was handled",
  input: { // autocastable to DateTimePickerInput
    type: "datetime-picker",
      includeTime: true,
      min: 1547678342000,
      max: 1610836742000
    }
});

const fieldElement3 = new FieldElement({
  fieldName: "placename",
  label: "Business name",
  editable: false
});

const fieldElement4 = new FieldElement({
  fieldName: "floodinsur",
  label: "Flood insurance",
  input: { // autocastable to RadioButtonsInput
    type: "radio-buttons",
    noValueOptionLabel: "No value",
    showNoValueOption: true
  }
});

// Next pass in any elements to the FormTemplate
const formTemplate = new FormTemplate({
  title: "Inspector report",
  description: "Enter all relevant information below",
  elements: [fieldElement1, fieldElement2, fieldElement3, fieldElement4] // Add all elements to the template
});

相關用法


注:本文由純淨天空篩選整理自arcgis.com大神的英文原創作品 FieldElement。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。