Hide Table of Contents
Class: Field

require(["esri/layers/Field"], function(Field) { /* code goes here */ });


(Added at v2.0)
Information about each field in a layer. Field objects must be constructed when creating a FeatureLayer from a client-side feature collection. See the documentation of the FeatureLayer constructor for more details. This class allows you to define the schema of each field in the FeatureLayer. Note that you do not need to add fields to the constructor of a FeatureLayer loaded from a service since they are already defined by the service. See the FeatureCollection sample for an example of working with this class.


Search for samples that use this class.


aliasStringThe alias name for the field.
domainDomainDomain associated with the field.
editableBooleanIndicates whether the field is editable.
lengthNumberThe field length.
nameStringThe name of the field.
nullableBooleanIndicates if the field can accept null values.
typeStringThe data type of the field.
Property Details

<String> alias

The alias name for the field.

<Domain> domain

Domain associated with the field.

<Boolean> editable

Indicates whether the field is editable.
Known values: true | false

<Number> length

The field length

<String> name

The name of the field.

<Boolean> nullable

Indicates if the field can accept null values. Requires ArcGIS Server version 10.1 or greater. (Added at v2.6)
Known values: true | false

<String> type

The data type of the field.

Can be one of the following: "esriFieldTypeSmallInteger", "esriFieldTypeInteger", "esriFieldTypeSingle", "esriFieldTypeDouble", "esriFieldTypeString", "esriFieldTypeDate", "esriFieldTypeOID", "esriFieldTypeGeometry", "esriFieldTypeBlob", "esriFieldTypeRaster", "esriFieldTypeGUID", "esriFieldTypeGlobalID", "esriFieldTypeXML"
Show Modal