Skip to main content

MVCxGanttItemUpdateValues<TItem, TKey> Class

Serves as a base class for classes that contain information about updated objects.

Namespace: DevExpress.Web.Mvc

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

NuGet Package: DevExpress.Web.Mvc5

Declaration

public abstract class MVCxGanttItemUpdateValues<TItem, TKey> :
    MVCxBatchUpdateValues<TItem, TKey>,
    IGantBatchValues
    where TItem : new()

Type Parameters

Name Description
TItem

A type of an object.

TKey

A type of an object key.

Remarks

The following example illustrates how to use the MVCxGanttTaskUpdateValues object that is a descendant of the MVCxGanttItemUpdateValues base class. 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, dependencyUpdateValues);
}

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));
    }    
}

Online Demo

Gantt - Data Binding and Modification

See Also