Hide Table of Contents
esri/dijit/util
esri/process
esri/toolbars
esri/workers
Class: Editor
[ AMD Module Require | Legacy Module Require ]

dojo.require("esri.dijit.editing.Editor")

Description

(Added at v2.0)
The Editor widget provides out-of-the-box editing capabilities using an editable layer in a Feature Service. It combines the out-of-the-box TemplatePicker, AttachmentEditor, AttributeInspector and GeometryService to provide feature and attribute editing. When building editing applications, try to take advantage of the customizable out-of-the-box Editor widget when possible.

Editing behaviors:
  • To create features, click a feature template in the template picker then start drawing the feature.
  • To move features, click and drag the feature to a new location.
  • To delete features, click the feature then press the 'Delete' button on the attribute inspector.
  • To edit features, click the feature to display the vertices and the attribute inspector.
  • Editing Vertices:
    • Add new vertices by clicking a ghost vertex.
    • Right-click to delete a vertex.
    • Click and drag to move a vertex to a new location.
  • Attribute edits are saved automatically when you change selection, change the focus field, or press enter.
  • Geometry edits are saved automatically.
Load the Editor using one of the statements below. See the Coding Guidelines help topic for details.
require(["esri/dijit/Editor-all", ... ], function(Editor, ... ){ ... });
or
require(["esri/dijit/Editor", ... ], function(Editor, ... ){ ... });

Samples

Search for samples that use this class.

Constructors

NameSummary
new esri.dijit.editing.Editor(params, srcNodeRef)Creates a new Editor object.

Constants

NameDescription
CREATE_TOOL_ARROWArrow tool
CREATE_TOOL_AUTOCOMPLETEAutocomplete polygon tool
CREATE_TOOL_CIRCLECircle tool
CREATE_TOOL_ELLIPSEEllipse tool
CREATE_TOOL_FREEHAND_POLYGONFreehand polygon tool
CREATE_TOOL_FREEHAND_POLYLINEFreehand polyline tool
CREATE_TOOL_POLYGONPolygon tool
CREATE_TOOL_POLYLINEPolyline tool
CREATE_TOOL_RECTANGLERectangle tool
CREATE_TOOL_TRIANGLETriangle tool

Methods

NameReturn typeSummary
startup()NoneFinalizes the creation of the widget.

Events

[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.

Events

NameEvent ObjectSummary
loadFires when the widget has fully loaded.
Constructor Details

new esri.dijit.editing.Editor(params, srcNodeRef)

Creates a new Editor object.
Parameters:
<Object> params Required Parameters that define the functionality of the editor widget. Create a new settings object to pass to the widget (see options).
<Node | String> srcNodeRef Required HTML element where the widget should be rendered.
params properties:
<Object> settings Optional Create a new settings object that defines the capabilities of the widget. See the object specifications table below for details.
Object Specifications:
<createOptions>
<String[]> polygonDrawTools See the constants list for valid options.
<String[]> polylineDrawTools See the constants list for valid options.
<fieldInfo>
<dijit> customField Specify a custom dijit as the editor for this field.
<String> fieldName The name of the field to customize.
<Object> format Opt-in to allow the editing of time on a date field. An object with a single boolean property named "time".
<Boolean> isEditable Disable editing of the field. Setting this to true does not override a false value from the server.
<String> label Define a label for the field. Setting this overrides the alias and field name from the service.
<String> richTextPlugins Use this option to override the default setting for the plug-in when using the rich text editor. See dijit/Editor for details.
<String> stringFieldOption Set the type of field to use when editing string values. See the constants table for a list of valid values.
<String> tooltip Define a tooltip for the field.
<toolbarOptions>
<Boolean> cutVisible If true show the cut tool.
<Boolean> mergeVisible If true show the merge tool.
<Boolean> reshapeVisible If true show the reshape tool.
<layerInfo>
<Boolean> disableAttributeUpdate If true, attributeInspector won't pop up when features in this featureLayer are selected. When adding a new feature, attributeInspector won't pop up either.
<Boolean> disableGeometryUpdate When true, the geometry is not editable. The default value is false. Requires ArcGIS Server feature service version 10.1 or greater (As of 2.6).
<FeatureLayer> featureLayer Reference to the feature layer.
<Object[]> fieldInfos Customize how fields appear in the attribute inspector. If nothing is specified all fields, except the ObjectId and GlobalId are displayed. Specify FieldInfos to explicitly define the fields that are displayed and the field order. Added at version 2.2. See the fieldInfo object specifications table for details of each object.
<Boolean> showGlobalID Default is false. When true display the GlobalID field in the attribute inspector.
<Boolean> showObjectID Default is false. When true display the ObjectID field in the attribute inspector.
<String> userId Provide a userId for the currently logged-in user. If the application is using the IdentityManager it is not necessary to specify a userId since the feature layer has access to the credential object which contains this information. Requires ArcGIS Server feature service version 10.1 or greater (As of 2.6).
<settings>
<Object> createOptions Specify the polygon and polyline draw tools to include on the toolbar. Only applicable when toolbarVisible is true. See the createOptions object specifications table for details.
<Boolean> enableUndoRedo When true, enable undo/redo behavior.
<String> geometryService Reference to the geometry service. Alternatively, you can set the geometry service using esri.config.defaults.geometryService (Required).
<String[]> htmlFields Specify which fields to display as a rich text editor.
<Object[]> layerInfos Array of feature layer information objects. See the layerInfo object specifications table for details of each object.
<Map> map Reference to the map (Required).
<Number> maxUndoRedoOperations When undo/redo is enabled, specify the maximum number of undo/redo operations to maintain. Default value is 10.
<TemplatePicker> templatePicker Reference to the TemplatePicker. Use this option if you want to modify the appearance of the template picker, for example set the number of rows and columns.
<Object> toolbarOptions Specify the tools to include on the toolbar. Only applicable when toolbarVisible is true. See the toolbarOptions object specifications table for details.
<Boolean> toolbarVisible If true display the editing toolbar.
<UndoManager> undoManager Specify an instance of the UndoManager for the Editor.
Sample:

Create a settings object that defines the capabilities of the widget.

var settings = {
  map: map,
  geometryService: new esri.tasks.GeometryService("http://servery/arcgis/rest/services/Geometry/GeometryServer"),
  createOptions: { polygonDrawTools:[esri.dijit.editing.Editor.CREATE_TOOL_FREEHAND_POLYGON] },
  layerInfos:layerInfos  
};

Pass the settings to the widget

var params = {settings: settings};
var myFeatureServiceWidget = new esri.dijit.editing.Editor(params,'divFeatureServiceDijit');
myFeatureServiceWidget.startup();
Method Details

startup()

Finalizes the creation of the widget. (Added at v3.12)
Event Details
[ On Style Events | Connect Style Event ]

load

Fires when the widget has fully loaded.