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.
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
Properties
label | String | Details about the operation, for example: "Update" may be the label for an edit operation that updates features. |
type | String | The type of operation, for example: "edit" or "navigation". |
Methods
Constructor Details
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
Details about the operation, for example: "Update" may be the label for an edit operation that updates features.
The type of operation, for example: "edit" or "navigation".
Method Details
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);
}
Reverse the operation. When inheriting from OperationBase provide a custom implementation for this method.
Sample:
performUndo: function () {
this.graphicsLayer.remove(this._addedGraphic);
}