Provides the logic for the Feature widget.
- See also
Constructors
-
new FeatureViewModel(properties)
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
Abilities | Defines the specific abilities that the Feature and Popup widgets should use when querying and displaying its content. more details | FeatureViewModel | |
Content[]|Widget|HTMLElement|String | The content of the feature. more details | FeatureViewModel | |
String | The name of the class. more details | Accessor | |
Boolean | Enables automatic creation of a popup template for layers that have popups enabled but no popupTemplate defined. more details | FeatureViewModel | |
Object | The formatted attributes calculated from | FeatureViewModel | |
Graphic | The Graphic used to represent the feature. more details | FeatureViewModel | |
Object | A read-only property containing metadata regarding the last edit performed on a feature. more details | FeatureViewModel | |
Map | A reference to the view's Map. more details | FeatureViewModel | |
SpatialReference | The spatial reference used for Arcade operations. more details | FeatureViewModel | |
String | The view model's state. more details | FeatureViewModel | |
String | The title for the feature. more details | FeatureViewModel | |
MapView|SceneView | A reference to the MapView or SceneView. more details | FeatureViewModel | |
Boolean | Indicates whether the feature is currently waiting for all of its content to finish loading. more details | FeatureViewModel |
Property Details
-
Since: ArcGIS Maps SDK for JavaScript 4.21
-
Defines the specific abilities that the Feature and Popup widgets should use when querying and displaying its content.
-
-
The content of the feature.
- Default Value:null
-
The name of the class. The declared class name is formatted as
esri.folder.className
.
-
defaultPopupTemplateEnabled BooleanSince: ArcGIS Maps SDK 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, GeoJSONLayer, OGCFeatureLayer, SceneLayer, CSVLayer, PointCloudLayer, 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
The formatted attributes specified at the root level of the PopupTemplate using the PopupTemplate.fieldInfos property.
content ObjectThe 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
Examplelet 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:
-
map MapSince: ArcGIS Maps SDK 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 SpatialReferenceSince: ArcGIS Maps SDK for JavaScript 4.11
-
The spatial reference used for Arcade operations.
- Default Value:null
- See also
-
state StringreadonlySince: ArcGIS Maps SDK for JavaScript 4.21
-
The view model's state.
Possible Values:"ready"|"disabled"|"error"|"loading"
- Default Value:disabled
-
title Stringreadonly
-
The title for the feature.
-
waitingForContent Booleanreadonly
-
Indicates whether the feature is currently waiting for all of its content to finish loading.
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. more details | Accessor | ||
Boolean | Returns true if a named group of handles exist. more details | Accessor | |
Paginates to the next media info. more details | FeatureViewModel | ||
Paginates to the previous media info in the specified media content element. more details | FeatureViewModel | ||
Removes a group of handles owned by the object. more details | Accessor | ||
Paginates to a specified media info object. more details | FeatureViewModel |
Method Details
-
addHandles(handleOrHandles, groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
Adds one or more handles which are to be tied to the lifecycle of the object. The handles will be removed when the object is destroyed.
// Manually manage handles const handle = reactiveUtils.when( () => !view.updating, () => { wkidSelect.disabled = false; }, { once: true } ); this.addHandles(handle); // Destroy the object this.destroy();
ParametershandleOrHandles WatchHandle|WatchHandle[]Handles marked for removal once the object is destroyed.
groupKey *optionalKey identifying the group to which the handles should be added. All the handles in the group can later be removed with Accessor.removeHandles(). If no key is provided the handles are added to a default group.
-
Since: ArcGIS Maps SDK for JavaScript 4.25
-
Returns true if a named group of handles exist.
ParametergroupKey *optionalA group key.
ReturnsType Description Boolean Returns true
if a named group of handles exist.Example// Remove a named group of handles if they exist. if (obj.hasHandles("watch-view-updates")) { obj.removeHandles("watch-view-updates"); }
-
nextMedia(contentElementIndex)
-
Paginates to the next media info.
ParametercontentElementIndex NumberThe index position of the media content element.
-
previousMedia(contentElementIndex)
-
ParametercontentElementIndex Number
The index position of the media content element.
-
removeHandles(groupKey)inheritedSince: ArcGIS Maps SDK for JavaScript 4.25
-
Removes a group of handles owned by the object.
ParametergroupKey *optionalA group key or an array or collection of group keys to remove.
Exampleobj.removeHandles(); // removes handles from default group obj.removeHandles("handle-group"); obj.removeHandles("other-handle-group");
-
setActiveMedia(contentElementIndex, mediaInfoIndex)
-
Paginates to a specified media info object. For example, you may have media content which contains multiple
mediaInfos
. This method allows you to specify the index of themediaInfos
you wish to display.Prior to version 4.17, this method was named
goToMedia
.ParameterscontentElementIndex NumberThe index position of the media content element to be updated.
mediaInfoIndex NumberThe index position of the media info object you wish to display.
Type Definitions
-
Abilities
-
- Properties
-
attachmentsContent Boolean
Indicate whether the widget should query and display attachments associated with the feature. Default value is
true
.chartAnimation BooleanIndicate whether the widget should display animations for charts residing in media content elements. Default value is
true
.customContent BooleanIndicate whether the widget should display any custom content elements. Default value is
true
.fieldsContent BooleanIndicate whether the widget should display any fields content elements. Default value is
true
.mediaContent BooleanIndicate whether the widget should display any media content elements. Default value is
true
.textContent BooleanIndicate whether the widget should display any text content elements. Default value is
true
.