Skip to main content
All docs
V19.2

GanttExtension.GetBatchUpdateResult<TTask, TTaskKey>(MVCxGanttTaskUpdateValues<TTask, TTaskKey>) Method

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

Namespace: DevExpress.Web.Mvc

Assembly: DevExpress.Web.Mvc5.v19.2.dll

Declaration

public static ActionResult GetBatchUpdateResult<TTask, TTaskKey>(
    MVCxGanttTaskUpdateValues<TTask, TTaskKey> taskUpdateValues
)
    where TTask : new()

Parameters

Name Type Description
taskUpdateValues MVCxGanttTaskUpdateValues<TTask, TTaskKey>

An object that stores information about updated tasks.

Type Parameters

Name Description
TTask

A type of a task.

TTaskKey

A type of a task key.

Returns

Type Description
ActionResult

The action method’s result.

Remarks

The following example illustrates how to use the GetBatchUpdateResult method. Refer to the online demo to get the full code.

Partial View:

@Html.DevExpress().Gantt(settings => {
    settings.BatchUpdateRouteValues = new { Controller = "Features", Action = "GanttBatchUpdate" };
    // ...
}).Bind(
    GanttDataProvider.Tasks, 
    GanttDataProvider.Dependencies, 
    GanttDataProvider.Resources, 
    GanttDataProvider.ResourceAssignments
).GetHtml()

Controller Code:

public ActionResult GanttBatchUpdate(MVCxGanttTaskUpdateValues<Task, string> taskUpdateValues){
    ProcessTaskValues(taskUpdateValues);
    return GanttExtension.GetBatchUpdateResult(taskUpdateValues);
}

void ProcessTaskValues(MVCxGanttTaskUpdateValues<Task, string> taskUpdateValues) {
    foreach(var item in taskUpdateValues.Update)
        GanttDataProvider.UpdateTask(item);
    foreach(var itemKey in taskUpdateValues.DeleteKeys)
        GanttDataProvider.DeleteTask(itemKey);
    foreach(var item in taskUpdateValues.Insert) {
        taskUpdateValues.MapInsertedItemKey(item, GanttDataProvider.InsertTask(item));
    }
}

Model:

public static void UpdateTask(Task task) {
    // your code
}
public static string InsertTask(Task task) {
    // your code
}
public static void DeleteTask(string id) {
    // your code
}

Online Demo

Gantt - Data Binding and Modification

See Also