Hide Table of Contents
Class: Editor
[ AMD Module Require | Legacy Module Require ]


Class added at v2.0
Load the Editor using one of the dojo.require statements below. See the Coding Guidelines help topic for details.
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.


Search for samples that use this class.

Class hierarchy



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


CREATE_TOOL_AUTOCOMPLETEAutocomplete polygon tool
Constructor Details

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

Creates a new Editor object.
<Object> params Required Parameters that define the functionality of the editor widget. Create a new settings object to pass to the widget (see options).
<DOMNode | String> srcNodeRef Required HTML element where the widget should be rendered.
<Object> settings Optional Create a new settings object that defines the capabilities of the widget.
  • <Object> createOptions: Specify the polygon and polyline draw tools to include on the toolbar. Only applicable when toolbarVisible is true. This object has following properties:
    • <String[]> polylineDrawTools: See the constants list for valid options.
    • <String[]> polygonDrawTools: See the constants list for valid options.
  • <Boolean> enableUndoRedo: Default is false. 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).
  • <Map> map: Reference to the map (Required).
  • <Number> maxUndoRedoOperations: When undo/redo is enabled, specify the maximum number of undo/redo operations to maintain. The 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. This object has following properties:
    • <Boolean> mergeVisible: If true show the merge tool.
    • <Boolean> cutVisible: If true show the cut tool.
    • <Boolean> reshapeVisible: If true show the reshape tool.
  • <Boolean> toolbarVisible: If true display the editing toolbar.
  • <UndoManager> undoManager: Specify an instance of the UndoManager for the Editor.
  • <Object> layerInfos: Feature layer information. This object has following properties:
    • <FeatureLayer> featureLayer: Reference to the feature layer.
    • <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)
    • <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)
    • <Boolean> showObjectID: Default is false. When true display the ObjectID field in the attribute inspector.
    • <Boolean> showGlobalID: Default is false. When true display the GlobalID field in the attribute inspector.
    • <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 sample section below for properties.
    • <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.
  • <String[]> htmlFields: Specify which fields to display as a rich text editor.

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] },

Pass the settings to the widget

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

Each object in the fieldInfos array under layerInfos has the following properties:

  • <String> fieldName: The name of the field to customize.
  • <String> label: Define a label for the field. Setting this overrides the alias and field name from the service.
  • <Boolean> isEditable: Disable editing of the field. Setting this to true does not override a false value from the server.
  • <String> tooltip: Define a tooltip for the field.
  • <String> stringFieldOption: Set the type of field to use when editing string values. See the constants table for a list of valid values.
  • <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.
  • <dijit> customField: Specify a custom dijit as the editor for this field.