DiagramSettings.BatchUpdateRouteValues Property
Specifies the names of a controller and an action that should handle callbacks related to node and edge updates.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.1.dll
NuGet Package: DevExpress.Web.Mvc5
Declaration
Property Value
Type | Description |
---|---|
Object | An object that contains the Controller and Action names. |
Remarks
If the Diagram extension is bound to a data source (Bind) and is not read-only (ReadOnly), you should provide a controller action that will apply edit operations to a model. Use the BatchUpdateRouteValues property to reference this controller action by its name and the name of its controller.
Important
When you bind the Diagram extension to a data source, use the MapInsertedItemKey(TItem, TKey) method to provide key values for the inserted items.
@Html.DevExpress().Diagram(settings => {
settings.Name = "Diagram";
settings.BatchUpdateRouteValues = new { Controller = "DataBinding", Action = "NodesAndEdgesUpdate" };
settings.Mappings.Node.Key = "ID";
settings.Mappings.Edge.Key = "ID";
settings.Mappings.Edge.FromKey = "FromID";
settings.Mappings.Edge.ToKey = "ToID";
}).Bind(Model.Objects, Model.Connections).GetHtml()
public ActionResult NodesAndEdgesUpdate(MVCxDiagramNodeUpdateValues<EditableFlowObject, int>
nodeUpdateValues, MVCxDiagramEdgeUpdateValues<EditableFlowConnection, int> edgeUpdateValues) {
foreach(var item in nodeUpdateValues.Update)
WorkflowDataProvider.UpdateObject(item);
foreach(var itemKey in nodeUpdateValues.DeleteKeys)
WorkflowDataProvider.DeleteObject(itemKey);
foreach(var item in nodeUpdateValues.Insert) {
var insertedItem = WorkflowDataProvider.InsertObject(item);
nodeUpdateValues.MapInsertedItemKey(item, insertedItem.ID);
}
foreach(var item in edgeUpdateValues.Update)
WorkflowDataProvider.UpdateConnection(item);
foreach(var itemKey in edgeUpdateValues.DeleteKeys)
WorkflowDataProvider.DeleteConnection(itemKey);
foreach(var item in edgeUpdateValues.Insert) {
var insertedItem = WorkflowDataProvider.InsertConnection(item);
edgeUpdateValues.MapInsertedItemKey(item, insertedItem.ID);
}
return DiagramExtension.GetBatchUpdateResult(nodeUpdateValues, edgeUpdateValues);
}