Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: OperationBase

dojo.require("esri.OperationBase")

Description

(Added at v2.2)
The OperationBase class defines operations that can be added to the UndoManager. Extend this class to create custom operations. The following edit operations in the esri/dijit/editing namespace inherit from this class.


Operation Name Constructor
Add new Add(params)
Delete new Delete(params)
Update new Update(params)
Cut new Cut(params)
Union new Union(params)

Samples

Search for samples that use this class.

Subclasses

Constructors

NameSummary
new esri.OperationBase(params)Creates a new OperationBase object.

Properties

NameTypeSummary
labelStringDetails about the operation, for example: "Update" may be the label for an edit operation that updates features.
typeStringThe type of operation, for example: "edit" or "navigation".

Methods

NameReturn typeSummary
performRedo()NoneRe-perform the last undo operation.
performUndo()NoneReverse the operation.
Constructor Details

new esri.OperationBase(params)

Creates a new OperationBase object.
Parameters:
<Object> params Required See options list for parameters.
params properties:
<String> label Optional Provide information about the operation.
<String> type Optional Specify the type of operation, for example: "edit" or "navigation".
Sample:
dojo.declare("myModules.customoperation.Add", esri.OperationBase, {
  label: "Add Graphic",
  constructor: function ( /*graphicsLayer, addedGraphic*/ params) {
    params = params || {};
    if (!params.graphicsLayer) {
      console.error("graphicsLayer is not provided");
      return;
    }
    this.graphicsLayer = params.graphicsLayer;

    if (!params.addedGraphic) {
      console.error("no graphics provided");
      return;
    }
    this._addedGraphic = params.addedGraphic;
  }
});
Property Details

<String> label

Details about the operation, for example: "Update" may be the label for an edit operation that updates features.

<String> type

The type of operation, for example: "edit" or "navigation".
Method Details

performRedo()

Re-perform the last undo operation. When inherting from OperationBase provide a custom implementation for this method.
Sample:

performRedo: function () {

  this.graphicsLayer.add(this._addedGraphic);

}

performUndo()

Reverse the operation. When inheriting from OperationBase provide a custom implementation for this method.
Sample:

performUndo: function () {

  this.graphicsLayer.remove(this._addedGraphic);

}

Show Modal