require(["esri/widgets/Editor/support/EditorItem"], (EditorItem) => { /* code goes here */ });
import EditorItem from "@arcgis/core/widgets/Editor/support/EditorItem.js";
esri/widgets/Editor/support/EditorItem
A predominantly read-only editable item that corresponds to the feature being updated. This class is used by the Editor widget to manage editing capabilities based on the provided layer and permissions set on it. It can be accessed through the Editor's view model's editorItems. Although the returned collection is primarily read-only, it is possible to modify its disabled property after construction. Also, it can be used in situations where custom functionality is used without the need to reference the Editor widget directly. In this scenario, the item can be constructed and used to determine the editing capabilities for a specific layer.
- See also
//Create the Editor widget with a feature layer and form template
const editor = new Editor({
view: view,
layerInfos: [{
layer: featureLayer, // references an existing feature layer
formTemplate: formTemplate // references an existing form template
}]
});
// Access the EditorItem from the Editor's view model
const editorItem = editor.viewModel.editorItems.find(item => item.layer === featureLayer);
//Check if the item is editable and if so, disable it
const isEditable = editorItem?.editable;
if (isEditable) {
editorItem.disabled = true;
}
// This creates a new EditorItem instance without the need to reference the Editor widget. It determines the editing capabilities for a specific layer.
const editorItem = new EditorItem({
layer: featureLayer, // This property is required if creating a new instance of EditorItem
layerInfo: featureLayerInfo
});
Constructors
-
Parameterproperties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Example// This creates a new EditorItem instance without the need to reference the Editor widget. It determines the editing capabilities for a specific layer. const editorItem = new EditorItem({ layer: featureLayer, // This property is required if creating a new instance of EditorItem layerInfo: featureLayerInfo });
Property Overview
Name | Type | Summary | Class |
---|---|---|---|
The current editing capabilities for the provided layer. | EditorItem | ||
The name of the class. | Accessor | ||
Indicates whether to override editable to | EditorItem | ||
Indicates whether at least one edit operation is supported in capabilities. | EditorItem | ||
A reference to the primary FormTemplate in use. | EditorItem | ||
Indicates whether the primary FormTemplate has an unknown (invalid) field. | EditorItem | ||
Indicates whether the associated layer is of type | EditorItem | ||
The FeatureLayer or SubtypeSublayer currently being edited. | EditorItem | ||
The layerInfo for the provided layer. | EditorItem | ||
Indicates whether the item supports starting a new create features workflow based on specific conditions set within the Editor. | EditorItem | ||
Indicates whether the item supports starting a new update workflow based on specific conditions set within the Editor. | EditorItem | ||
Indicates whether the associated layer and its parent are visible. | EditorItem |
Property Details
-
capabilities
capabilities EditorEditingCapabilitiesreadonly
-
The current editing capabilities for the provided layer.
-
editable
editable Booleanreadonly
-
Indicates whether at least one edit operation is supported in capabilities. It is primarily used for filtering layers eligible for editing. For UI purposes, specific permissions can still be confirmed using capabilities. Additionally, editable takes into account the value for disabled as a means to temporarily disable editing functionality.
- Default Value:false
-
formTemplate
formTemplate FormTemplatereadonly
-
A reference to the primary FormTemplate in use. A form template set within the Editor widget's layerInfos takes priority over a form template set directly on a FeatureLayer or SubtypeSublayer.
-
hasInvalidFormTemplate
hasInvalidFormTemplate Booleanreadonly
-
Indicates whether the primary FormTemplate has an unknown (invalid) field. Editing is typically disabled in this scenario.
- Default Value:false
- See also
-
isTable
isTable Boolean
-
Indicates whether the associated layer is of type
Table
.- Default Value:false
- See also
-
layer
layer FeatureLayer |SubtypeSublayer
-
The FeatureLayer or SubtypeSublayer currently being edited.
-
supportsCreateFeaturesWorkflow
supportsCreateFeaturesWorkflow Booleanreadonly
-
Indicates whether the item supports starting a new create features workflow based on specific conditions set within the Editor.
- Default Value:false
-
supportsUpdateWorkflow
supportsUpdateWorkflow Booleanreadonly
-
Indicates whether the item supports starting a new update workflow based on specific conditions set within the Editor. This includes allowing attachments even when
update
is not allowed, or preventing edits when the layer or its parent are not visible.- Default Value:false
-
visible
visible Booleanreadonly
-
Indicates whether the associated layer and its parent are visible.
- Default Value:false
Method Overview
Name | Return Type | Summary | Class |
---|---|---|---|
Adds one or more handles which are to be tied to the lifecycle of the object. | Accessor | ||
Returns true if a named group of handles exist. | Accessor | ||
Removes a group of handles owned by the object. | Accessor |
Method Details
-
Inherited from Accessor
-
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.
-
hasHandles
InheritedMethodhasHandles(groupKey){Boolean}
Inherited from Accessor -
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"); }
-
Inherited from Accessor
-
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");
Type Definitions
-
CreateCapabilities
CreateCapabilities Object
-
Specific permissions for create operations. It takes into account the Editor's layerInfo settings.
- Properties
-
attachments AttachmentCapabilities
The editing capabilities for attachments.
attributes BooleanIndicates whether attributes can be created on the editable layer.
enabled BooleanIndicates whether create operations are enabled on the editable layer.
geometry BooleanIndicates whether a geometry can be created on the editable layer.
reliesOnOwnerAdminPrivileges BooleanIndicates when editing is enabled and is only due to administrative permissions. It returns
false
for any users if editing is generally enabled.
-
DefaultEditingCapabilities
DefaultEditingCapabilities Object
-
The default editing capabilities for the provided layer.
- Properties
-
attachments AttachmentCapabilities
The editing capabilities for attachments.
create CreateCapabilitiesThe editing capabilities for creating features.
delete DeleteCapabilitiesThe editing capabilities for deleting features.
layer FeatureLayer|SubtypeSublayerThe FeatureLayer or SubtypeSublayer currently being edited.
reliesOnOwnerAdminPrivileges BooleanIndicates when editing is enabled and is only due to administrative permissions. It returns
false
for any users if editing is generally enabled.update UpdateCapabilitiesThe editing capabilities for updating features.
-
DeleteCapabilities
DeleteCapabilities Object
-
Specific permissions for delete operations. Accounts for layerInfo settings.
-
EditorEditingCapabilities
EditorEditingCapabilities Object
-
The current editing capabilities for the provided layer and read by the Editor. This takes into account what is set on the layerInfo
- Properties
-
attachments AttachmentCapabilities
Specific permissions for attachment operations. It takes into account what is set on the layerInfo.
create CreateCapabilitiesSpecific permissions for create operations. It takes into account what is set on the layerInfo.
defaults DefaultEditingCapabilitiesThe default editing capabilities for the provided layer. This does not take into account what may be set on the layerInfo settings.
delete DeleteCapabilitiesSpecific permissions for delete operations. It takes into account what is set on the layerInfo.
formTemplate FormTemplateThe primary form template in use. It takes into account the Editor's layerInfos and whether a form template is set on a
layerInfo
within it. If so, the form template set on a layerInfo within the Editor takes precedence over a form template set directly on a FeatureLayer or SubtypeSublayer.layer FeatureLayer|SubtypeSublayerThe associated layer.
layerInfo LayerInfoThe layer's associated layerInfo .
relationship RelationshipCapabilitiesSpecific permissions for relationship operations. It takes into account what is set on the layerInfo.
reliesOnOwnerAdminPrivileges BooleanIndicates when editing is enabled only due to administrative permissions. It returns
false
for any users if editing is generally enabled.update UpdateCapabilitiesSpecific permission`s for update operations. It takes into account what is set on the layerInfo.
-
RelationshipCapabilities
RelationshipCapabilities Object
-
Specific permissions for relationship operations. It takes into account the Editor's layerInfo settings.
-
UpdateCapabilities
UpdateCapabilities Object
-
Specific permissions for update operations. It takes into account the Editor's layerInfo settings.
- Properties
-
attachments AttachmentCapabilities
The editing capabilities for attachments.
attributes BooleanIndicates whether attributes can be updated on the editable layer.
enabled BooleanIndicates whether update operations are enabled on the editable layer.
geometry BooleanIndicates whether a geometry can be updated on the editable layer.
reliesOnOwnerAdminPrivileges BooleanIndicates when editing is enabled and is only due to administrative permissions. It returns
false
for any users if editing is generally enabled.