ASPxClientDiagram.RequestEditOperation Event
Allows you to prohibit an edit operation at run time.
Declaration
RequestEditOperation: ASPxClientEvent<ASPxClientDiagramRequestEditOperationEventHandler<ASPxClientDiagram>>
Event Data
The RequestEditOperation event's data class is ASPxClientDiagramRequestEditOperationEventArgs. The following properties provide information specific to this event:
Property | Description |
---|---|
allowed | Specifies whether the edit operation is allowed. |
args | Contains information about the processed shape or connector. |
operation | Identifies the operation currently being processed. |
reason |
Remarks
The RequestEditOperation event requests information about an edit operation's availability. The event argument contains the following parameters.
The js-ASPxClientDiagramRequestEditOperationEventArgs.updateUI parameter identifies why the control requires the information.
true
value indicates that the control is updating the UI. You can prohibit an operation to hide the corresponding UI element.false
value indicates that a user attempts an edit operation. You can specify whether the operation is allowed, and, for instance, to display an error message if a user tries to perform a prohibited action.The operation parameter identifies the edit operation. Note that if you want to disable a specific operation type for the entire diagram, you can also set an Allow{Operation} property to
false
. The table below lists all available operations.Operation User action / IU update operation causes the event to be raised AddShape A user is about to add a shape / The control determines the Paste command's visibility. AddShapeFromToolbox A user starts dragging a shape from the toolbox / The control determines the visibility of a shape in the context toolbox. BeforeChangeConnectorText A user is about to edit a connector's text. BeforeChangeShapeText A user is about to edit a shape's text. ChangeConnection A user is about to link or delink a connector from a shape / The control determines a connection point's visibility. ChangeConnectorPoints A user changed a connector's points. ChangeConnectorText A user changed a connector's text. ChangeShapeText A user changed a shape's text. DeleteConnector A user is about to delete a connector / The control determines the Cut and Delete commands' visibility. DeleteShape A user is about to delete a shape / The control determines the visibility of the Cut and Delete commands. MoveShape A user moved a shape. ResizeShape A user resized a shape. The args parameter contains information about the shape or connector that takes part in the edit operation. The parameter's value type depends on the operation.
Set the allowed parameter to
false
to prohibit the operation.
<dx:ASPxDiagram ID="Diagram" runat="server" Width="100%" Height="600px">
<ClientSideEvents RequestEditOperation="onRequestEditOperation" />
...
</dx:ASPxDiagram>
function onRequestEditOperation(s, e) {
if(e.operation === DiagramEditOperation.ResizeShape) {
if(e.args.newSize.width < 1 || e.args.newSize.height < 0.75) {
!e.updateUI && showWarning("The shape size is too small.");
e.allowed = false;
}
}
else if(e.operation === DiagramEditOperation.ChangeShapeText) {
if(e.args.text === "") {
!e.updateUI && showWarning("A shape text cannot be empty.");
e.allowed = false;
}
}
...
}