Skip To ContentArcGIS for DevelopersSign In Dashboard

FeatureViewModel

require(["esri/widgets/Feature/FeatureViewModel"], function(FeatureVM) { /* code goes here */ });
Class: esri/widgets/Feature/FeatureViewModel
Inheritance: FeatureViewModel Accessor
Since: ArcGIS API for JavaScript 4.7

Provides the logic for the Feature widget.

See also:

Constructors

new FeatureViewModel(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
NameTypeSummaryClass
Content[]|Widget|HTMLElement|String

The content of the feature.

more details
more detailsFeatureViewModel
String

The name of the class.

more details
more detailsAccessor
Boolean

Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined.

more details
more detailsFeatureViewModel
Object

The formatted attributes calculated from fieldInfo PopupTemplate content.

more details
more detailsFeatureViewModel
Graphic

The Graphic used to represent the feature.

more details
more detailsFeatureViewModel
Object

A read-only property containing metadata regarding the last edit performed on a feature.

more details
more detailsFeatureViewModel
Map

A reference to the view's Map.

more details
more detailsFeatureViewModel
SpatialReference

The spatial reference used for Arcade operations.

more details
more detailsFeatureViewModel
String

The title for the feature.

more details
more detailsFeatureViewModel
MapView|SceneView

A reference to the MapView or SceneView.

more details
more detailsFeatureViewModel
Boolean

Indicates whether the feature is currently waiting for all of its content to finish loading.

more details
more detailsFeatureViewModel

Property Details

The content of the feature.

Default Value:null
declaredClass Stringreadonly inherited

The name of the class. The declared class name is formatted as esri.folder.className.

defaultPopupTemplateEnabled Boolean
Since: ArcGIS API for JavaScript 4.11

Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined. Automatic popup templates are supported for layers that support the createPopupTemplate method. (Supported for FeatureLayer, SceneLayer, CSVLayer, StreamLayer, and ImageryLayer).

Default Value:false
formattedAttributes Objectreadonly

The formatted attributes calculated from fieldInfo PopupTemplate content. They are obtained from the feature's graphic attribute values and can be read:

  • globally using the fieldInfos property directly at the root level of the PopupTemplate, or
  • per an individual content element. This element is defined with a fieldsContent popup element set on the PopupTemplate content property.
Properties:
global Object
optional

The formatted attributes specified at the root level of the PopupTemplate using the PopupTemplate.fieldInfos property.

content Object
optional

The formatted attributes for an individual content element. This is derived from the esri/PopupTemplate PopupTemplate, or per an individual content element. This element is defined with a fieldsContent popup element set on the PopupTemplate's content.

Default Value:null
graphic Graphic

The Graphic used to represent the feature.

Default Value:null
See also:
  • PopupTemplate.content
Example:
var graphic = new Graphic({
  geometry: view.center,
  attributes: {
    "name": "Spruce",
    "family": "Pinaceae",
    "count": 126
  },
  symbol: new SimpleMarkerSymbol({
    style: "square",
    color: "blue",
    size: "8px"
  }),
  popupTemplate: {
    content: [
      {
        // Set popup template content
      }
    ]
  }
});
lastEditInfo Objectreadonly

A read-only property containing metadata regarding the last edit performed on a feature. This object has the following properties:

Properties:
user String

User who performed the last edit on a feature.

date String

Date that the edit was performed.

type String

The type of edit that was performed on the feature.

Possible values: edit | create

map Map
Since: ArcGIS API for JavaScript 4.11

A reference to the view's Map. Use this property when needing to get access to the underlying layers within the map. This can then be used within Arcade expressions.

Default Value:null
See also:
Example:
// The building footprints repreent the buildings that intersect a clicked parcel
let buildingFootprints = Intersects($feature, FeatureSetByName($map, "Building Footprints"));
spatialReference SpatialReference
Since: ArcGIS API for JavaScript 4.11

The spatial reference used for Arcade operations.

Default Value:null
See also:
title Stringreadonly

The title for the feature.

A reference to the MapView or SceneView. Set this to link the widget to a specific view.

waitingForContent Booleanreadonly

Indicates whether the feature is currently waiting for all of its content to finish loading.

API Reference search results

NameTypeModule
Loading...