Skip to main content

DiagramExtension.GetBatchUpdateResult<TNode, TKey>(MVCxDiagramNodeUpdateValues<TNode, TKey>) Method

Returns the specified result to the client side after processing a callback in an action specified by the BatchUpdateRouteValues property.

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v24.1.dll

NuGet Package: DevExpress.Web.Mvc5

Declaration

public static ActionResult GetBatchUpdateResult<TNode, TKey>(
    MVCxDiagramNodeUpdateValues<TNode, TKey> nodeUpdateValues
)
    where TNode : new()

Parameters

Name Type Description
nodeUpdateValues MVCxDiagramNodeUpdateValues<TNode, TKey>

An object that stores information about updated diagram nodes.

Type Parameters

Name Description
TNode

The type of node.

TKey

The type of node key.

Returns

Type Description
ActionResult

The result of an action method.

Remarks

@Html.DevExpress().Diagram(settings => {
    settings.Name = "Diagram";

    settings.BatchUpdateRouteValues = new { Controller = "DataBinding", Action = "LinearUpdate" };

    settings.Mappings.Node.Key = "ID";
    settings.Mappings.Node.ParentKey = "ParentID";
    settings.Mappings.Node.Text = "DepartmentName";

    settings.SettingsAutoLayout.Type = DevExpress.Web.ASPxDiagram.DiagramAutoLayout.Tree;

}).Bind(Model).GetHtml()
public ActionResult LinearUpdate(MVCxDiagramNodeUpdateValues<EditableDepartment, int> nodeUpdateValues) {
    foreach(var item in nodeUpdateValues.Update)
        DepartmentProvider.Update(item);
    foreach(var itemKey in nodeUpdateValues.DeleteKeys)
        DepartmentProvider.Delete(itemKey);
    foreach(var item in nodeUpdateValues.Insert) {
        var insertedItem = DepartmentProvider.Insert(item);
        nodeUpdateValues.MapInsertedItemKey(item, insertedItem.ID);
    }
    return DiagramExtension.GetBatchUpdateResult(nodeUpdateValues);
}

Run Demo: Node and Edge Data Sources

See Also