import EditorItem from "@arcgis/core/widgets/Editor/support/EditorItem.js";const EditorItem = await $arcgis.import("@arcgis/core/widgets/Editor/support/EditorItem.js");- Inheritance:
- EditorItem→
Accessor
- Since
- ArcGIS Maps SDK for JavaScript 4.30
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
Examples
//Create the Editor widget with a feature layer and form templateconst 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 modelconst editorItem = editor.viewModel.editorItems.find(item => item.layer === featureLayer);//Check if the item is editable and if so, disable itconst 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
Constructor
Parameters
| Parameter | Type | Description | Required |
|---|---|---|---|
| properties | | |
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});Properties
| Property | Type | Class |
|---|---|---|
capabilities readonly | | |
declaredClass readonly inherited | ||
| | ||
editable readonly | | |
formTemplate readonly | | |
hasInvalidFormTemplate readonly | | |
isTable readonly | | |
| | ||
| | ||
supportsCreateFeaturesWorkflow readonly | | |
supportsMergeFeaturesWorkflow readonly | | |
supportsSplitFeatureWorkflow readonly | | |
supportsUpdateWorkflow readonly | | |
visible readonly | |
capabilities
The current editing capabilities for the provided layer.
editable
- Type
- boolean
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
- Type
- FormTemplate | null | undefined
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
- Type
- boolean
Indicates whether the primary FormTemplate has an unknown (invalid) field. Editing is typically disabled in this scenario.
- See also
- Default value
- false
isTable
- Type
- boolean
Indicates whether the associated layer is of type Table.
- See also
- Default value
- false
layerInfo
The LayerInfo for the provided layer.
- See also
supportsCreateFeaturesWorkflow
- Type
- boolean
Indicates whether the item supports starting a new create features workflow based on specific conditions set within the Editor.
- Default value
- false
supportsMergeFeaturesWorkflow
- Type
- boolean
Indicates whether the item supports starting a new merge features workflow based on specific conditions set within the Editor. Merge workflows require both update and create permissions, as they both create a new feature and update an existing feature.
supportsSplitFeatureWorkflow
- Type
- boolean
Indicates whether the item supports starting a new split feature workflow based on specific conditions set within the Editor. Split workflows require both update and create permissions, as they both create a new feature and update an existing feature.
supportsUpdateWorkflow
- Type
- boolean
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
- Type
- boolean
Indicates whether the associated layer and its parent are visible.
- Default value
- false