Hide Table of Contents
esri/plugins
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

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>
polygonDrawTools String[] See the constants list for valid options.
polylineDrawTools String[] See the constants list for valid options.
<fieldInfo>
customField dijit Specify a custom dijit as the editor for this field.
fieldName String The name of the field to customize.
format Object Opt-in to allow the editing of time on a date field. An object with a single boolean property named "time".
isEditable Boolean Disable editing of the field. Setting this to true does not override a false value from the server.
label String Define a label for the field. Setting this overrides the alias and field name from the service.
richTextPlugins String Use this option to override the default setting for the plug-in when using the rich text editor. See dijit/Editor for details.
stringFieldOption String Set the type of field to use when editing string values. See the constants table for a list of valid values.
tooltip String Define a tooltip for the field.
<toolbarOptions>
cutVisible Boolean If true show the cut tool.
mergeVisible Boolean If true show the merge tool.
reshapeVisible Boolean If true show the reshape tool.
<layerInfo>
disableAttributeUpdate Boolean 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.
disableGeometryUpdate Boolean 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.
fieldInfos Object[] 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.
showGlobalID Boolean Default is false. When true display the GlobalID field in the attribute inspector.
showObjectID Boolean Default is false. When true display the ObjectID field in the attribute inspector.
userId String 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>
createOptions Object 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.
enableUndoRedo Boolean When true, enable undo/redo behavior.
geometryService String Reference to the geometry service. Alternatively, you can set the geometry service using esri.config.defaults.geometryService (Required).
htmlFields String[] Specify which fields to display as a rich text editor.
layerInfos Object[] Array of feature layer information objects. See the layerInfo object specifications table for details of each object.
map Map Reference to the map (Required).
maxUndoRedoOperations Number 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.
toolbarOptions Object Specify the tools to include on the toolbar. Only applicable when toolbarVisible is true. See the toolbarOptions object specifications table for details.
toolbarVisible Boolean 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();
Event Details
[ On Style Events | Connect Style Event ]

load

Fires when the widget has fully loaded.