New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Column Menu

The Gantt provides a built-in option for triggering column operations through a menu.

To enable the Column Menu use .ColumnMenu() configuration method. As a result, the column headers of the Gantt's TreeList render a column menu, which allows the user to sort, filter, reorder, or change the visibility of a column. The column menu also detects when a specific column operation is disabled through the column definition and does not render the corresponding UI. For a runnable example, refer to the demo on configuring the Columns in the Gantt.

When the columnMenu configuration is enabled, the Gantt fires the client-side columnMenuInit and columnMenuOpen events instead of filterMenuInit and filterMenuOpen.

Column Reordering

As of Telerik UI for ASP.NET MVC R2 SP1 2023, the Gantt TreeList's Column Menu provides an option to change the position of the target column by using Move next and Move previous buttons.

    @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
        .Name("gantt")
        .Columns(columns =>
        {
            columns.Bound(c => c.TaskID).Title("ID").Width(50);
            columns.Bound(c => c.Title).Editable(true).Sortable(true);
            columns.Bound(c => c.Start).Width(100).Editable(true).Sortable(true);
            columns.Bound(c => c.End).Width(100).Editable(true).Sortable(true);
        })
        .ColumnMenu(true)
        .Reorderable(true)
        .DataSource(d => d
            .Model(m =>
            {
                m.Id(f => f.TaskID);
                m.ParentId(f => f.ParentID);
                m.Field(f => f.Expanded).DefaultValue(true);
            })
            .Read("Columns_ReadTasks", "Gantt")
            .Destroy("Columns_DestroyTask", "Gantt")
            .Update(update => update.Action("Columns_UpdateTask", "Gantt"))
            .Create(create => create.Action("Columns_CreateTask", "Gantt"))
        )
        .DependenciesDataSource(d => d
            .Model(m =>
            {
                m.Id(f => f.DependencyID);
                m.PredecessorId(f => f.PredecessorID);
                m.SuccessorId(f => f.SuccessorID);
            })
            .Read("Columns_ReadDependencies", "Gantt")
            .Create("Columns_CreateDependency", "Gantt")
            .Destroy("Columns_DestroyDependency", "Gantt")
        )
    )

See Also

In this article