Description
Class added v2.0Load the Editor using one of the dojo.require statements below. See the Coding Guidelines help topic for details.
dojo.require("esri.dijit.editing.Editor-all"); or
dojo.require("esri.dijit.editing.Editor");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.
Samples
Search for
samples that use this class.
Class hierarchy
esri.dijit.editing.Editor
Constructor
Constants
| CREATE_TOOL_ARROW |
Arrow tool |
| CREATE_TOOL_AUTOCOMPLETE |
Autocomplete polygon tool |
| CREATE_TOOL_CIRCLE |
Circle tool |
| CREATE_TOOL_ELLIPSE |
Ellipse tool |
| CREATE_TOOL_FREEHAND_POLYGON |
Freehand polygon tool |
| CREATE_TOOL_FREEHAND_POLYLINE |
Freehand polyline tool |
| CREATE_TOOL_POLYGON |
Polygon tool |
| CREATE_TOOL_POLYLINE |
Polyline tool |
| CREATE_TOOL_RECTANGLE |
Rectangle tool |
| CREATE_TOOL_TRIANGLE |
Triangle tool |
Constructor Detail
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).
|
|
<Object>
srcNodeRef |
Required |
HTML element where the widget should be rendered.
|
Options:
|
<Object>
settings |
Create a new settings object that defines the cababilites of the widget.
|
<Map> map
|
Required
|
Reference to the map.
|
|
<TemplatePicker> templatePicker
|
Optional
|
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. The following samples demonstrate setting the template picker option:
Editor widget (Selection mode)
Editor Widget with toolbar (reshape)
|
|
<String> geometryService
|
Required
|
Reference to the geometry service.
|
|
<Boolean> toolbarVisible
|
Optional
|
If true display the editing toolbar.
|
|
<Object> createOptions
|
Optional
|
Specify the polygon and polyline draw tools to include on the toolbar. Only applicable when toolbarVisible is true.
| <String[]> polylineDrawTools | See the constants list for valid options.
|
| <String[]> polygonDrawTools | See the constants list for valid options.
|
|
|
<Object> toolbarOptions
|
Optional
|
Specify the tools to include on the toolbar. Only applicable when toolbarVisible is true.
| <Boolean> mergeVisible | If true show the merge tool. |
| <Boolean> cutVisible | If true show the cut tool. |
| <Boolean> reshapeVisible | If true show the reshape tool. |
|
|
<Object> layerInfos
|
Optional
|
Feature layer information
| <FeatureLayer> featureLayer | Reference to the feature layer. |
| <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. |
| <String[]> htmlFields | Specify which fields to display as a rich text editor. |
|
|
Code snippets:
Create a settings object that defines the cababilities 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();