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

GanttBuilder

Methods

DataSource(System.Action)

Configures the DataSource options.

Parameters

configurator - System.Action<GanttDataSourceBuilder>

The DataSource configurator action.

Example


             @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .DataSource(source =>
                {
                    source.Read(read =>
                    {
                        read.Action("Read", "Gantt");
                    });
                })
            )

DataSource(System.String)

Passes the ID of a predefined DataSource instance.

Parameters

dataSourceId - System.String

The DataSource ID value.

Example


             @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .DataSource("DataSourceId")
            )

DependenciesDataSource(System.Action)

Configures the dependencies DataSource options.

Parameters

configurator - System.Action<GanttDependenciesDataSourceBuilder>

The DataSource configurator action.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .DependenciesDataSource(d => d
                 .Model(m =>
                 {
                     m.Id(f => f.DependencyIdField);
                     m.PredecessorId(f => f.PredecessorIdField);
                 })
             )
            )

DependenciesDataSource(System.String)

Passes the ID of a predefined DependenciesDataSource instance.

Parameters

dataSourceId - System.String

The DependenciesDataSource ID value.

Example


             @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .DependenciesDataSource("DependenciesDataSourceID")
            )

Columns(System.Action)

The configuration of the gantt columns. An array of JavaScript objects or strings. A JavaScript objects are interpreted as column configurations. Strings are interpreted as the field to which the column is bound. The gantt will create a column for every item of the array.

Parameters

configurator - System.Action<GanttColumnFactory>

The action that configures the columns.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                    .Columns(columns =>
                    {
                       columns.Bound(c => c.Title).Title("Task").Editable(true).Sortable(true).Width(255);
                       columns.Bound(c => c.PercentComplete).Title("% Complete").Editable(true).Width(100);
                    })
            )

Assignments(System.Action)

The configuration of the assignments of the gantt resources. An assignment is a one-to-one mapping between a gantt task and a gantt resource containing the number of units for which a resource is assigned to a task.

Parameters

configurator - System.Action<GanttAssignmentsSettingsBuilder>

The action that configures the assignments.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Assignments<ResourceAssignmentViewModel>(a => a
                    .DataResourceIdField("ResourceID")
                )
            )

CurrentTimeMarker(System.Action)

If set to false the "current time" marker of the Gantt would not be displayed.

Parameters

configurator - System.Action<GanttCurrentTimeMarkerSettingsBuilder>

The action that configures the currenttimemarker.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .CurrentTimeMarker(c => c.UpdateInterval(3000))
            )

Editable()

If set to false the user won't be able to create, modify or delete tasks and dependencies.

Resources(System.Action)

The configuration of the gantt resource(s). A gantt resource is optional metadata that can be associated with a gantt task.

Parameters

configurator - System.Action<GanttResourcesSettingsBuilder>

The action that configures the resources.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Resources(r=> r.DataFormatField("Field"))
            )

AutoBind(System.Boolean)

If set to false the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the data source is fired. By default the widget will bind to the data source specified in the configuration.

Parameters

value - System.Boolean

The value that configures the autobind.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .AutoBind(true)
            )

ColumnResizeHandleWidth(System.Double)

Defines the width of the column resize handle in pixels. Apply a larger value for easier grasping.

Parameters

value - System.Double

The value that configures the columnresizehandlewidth.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ColumnResizeHandleWidth(75)
            )

ColumnMenu(System.Boolean)

If set to true, the Gantt displays the column menu when the user clicks the Chevron icon in the column headers. The column menu allows the user to show and hide columns, and, if filtering and sorting are enabled, filter and sort the data. By default, the column menu is disabled. Can be set to a JavaScript object which represents the column menu configuration.

Parameters

value - System.Boolean

The value that configures the columnmenu.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ColumnMenu(true)
            )

Date(System.DateTime)

If set to some date and it is between the range start and range end of the selected view, the timeline of the currently selected view is scrolled to start from this date.

Parameters

value - System.DateTime

The value that configures the date.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Date(DateTime.Now)
            )

Editable(System.Boolean)

If set to false the user won't be able to create, modify or delete tasks and dependencies.

Parameters

enabled - System.Boolean

Enables or disables the editable option.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Editable(true)
            )

Editable(System.Action)

If set to false the user won't be able to create, modify or delete tasks and dependencies.

Parameters

configurator - System.Action<GanttEditableSettingsBuilder>

The action that configures the editable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Editable(e => e.Confirmation(true))
            )

Filterable(System.Boolean)

If set to true, the user can filter the data source by using the Gantt filter menu. By default, filtering is disabled. Can be set to a JavaScript object which represents the filter menu configuration.

Parameters

value - System.Boolean

The value that configures the filterable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Filterable(true)
            )

Reorderable(System.Boolean)

If set to true, the user can reorder the columns in the GanttList section of the widget by dragging their header cells. By default, reordering is disabled.

Parameters

value - System.Boolean

The value that configures the reorderable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Reorderable(true)
            )

If set to true the user could navigate the widget using the keyboard. By default keyboard navigation is enabled.

Parameters

value - System.Boolean

The value that configures the navigatable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Navigatable(true)
            )

WorkDayStart(System.DateTime)

Sets the start of the work day.

Parameters

value - System.DateTime

The value that configures the workdaystart.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .WorkDayStart(DateTime.Now)
            )

WorkDayEnd(System.DateTime)

Sets the end of the work day.

Parameters

value - System.DateTime

The value that configures the workdayend.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .WorkDayEnd(DateTime.Now)
            )

WorkWeekStart(System.Double)

The start of working week (index based).

Parameters

value - System.Double

The value that configures the workweekstart.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .WorkWeekStart(12)
            )

WorkWeekEnd(System.Double)

The end of working week (index based).

Parameters

value - System.Double

The value that configures the workweekend.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .WorkWeekEnd(12)
            )

HourSpan(System.Double)

The span of an hour slot.

Parameters

value - System.Double

The value that configures the hourspan.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .HourSpan(12)
            )

Snap(System.Boolean)

If set to true the Gantt will snap tasks to the nearest slot during dragging (resizing or moving). Set it to false to allow free moving and resizing of tasks.

Parameters

value - System.Boolean

The value that configures the snap.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Snap(true)
            )

Height(System.Double)

The height of the widget. Numeric values are treated as pixels.

Parameters

value - System.Double

The value that configures the height.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Height(500)
            )

ListWidth(System.String)

The width of the task list. Numeric values are treated as pixels.

Parameters

value - System.String

The value that configures the listwidth.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ListWidth("400")
            )

Messages(System.Action)

The configuration of the Gantt messages. Use this option to customize or localize the Gantt messages.

Parameters

configurator - System.Action<GanttMessagesSettingsBuilder>

The action that configures the messages.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Messages(m => m.PlannedTasks(ptm => ptm.SwitchText("Value")))
            )

Pdf(System.Action)

Configures the Kendo UI Gantt PDF export settings.

Parameters

configurator - System.Action<GanttPdfSettingsBuilder>

The action that configures the pdf.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Pdf(p => p.Author("Value"))
            )

Range(System.Action)

Configures the Kendo UI Gantt range settings.

Parameters

configurator - System.Action<GanttRangeSettingsBuilder>

The action that configures the range.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Range(r=>r.Start(DateTime.Now))
            )

Resizable(System.Boolean)

If set to true allows users to resize columns by dragging their header borders. By default resizing is disabled.

Parameters

value - System.Boolean

The value that configures the resizable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Resizable(true)
            )

Selectable(System.Boolean)

If set to false the user won't be able to select tasks in the Gantt. By default selection is enabled and triggers the change event.

Parameters

value - System.Boolean

The value that configures the selectable.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Selectable(true)
            )

ShowPlannedTasks(System.Boolean)

If set to true, the Gantt Timeline will render both the planned and the actual execution of tasks. In order to display properly, the Planned vs. Actual view would need the plannedStart and plannedEnd date fields for tasks to be set.

Parameters

value - System.Boolean

The value that configures the showplannedtasks.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ShowPlannedTasks(true)
            )

ShowWorkDays(System.Boolean)

If set to false, Gantt views will show all days of the week. By default the views display only business days.

Parameters

value - System.Boolean

The value that configures the showworkdays.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ShowWorkDays(true)
            )

ShowWorkHours(System.Boolean)

If set to false, the day view will show all hours of the day. By default the view displays only business hours.

Parameters

value - System.Boolean

The value that configures the showworkhours.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .ShowWorkHours(true)
            )

TaskTemplate(System.String)

The template used to render the gantt tasks.The fields which can be used in the template are the task fields

Parameters

value - System.String

The value that configures the tasktemplate.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .TaskTemplate("Value")
            )

TaskTemplateId(System.String)

The template used to render the gantt tasks.The fields which can be used in the template are the task fields

Parameters

value - System.String

The value that configures the tasktemplate.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .TaskTemplateId("Value")
            )

TaskTemplateView(System.Web.Mvc.MvcHtmlString)

The template used to render the gantt tasks.The fields which can be used in the template are the task fields

Parameters

value - System.Web.Mvc.MvcHtmlString

The value that configures the tasktemplate.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .TaskTemplateView(Html.Partial("TemplateView"))
            )

TaskTemplateHandler(System.String)

The template used to render the gantt tasks.The fields which can be used in the template are the task fields

Parameters

value - System.String

The value that configures the tasktemplate.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .TaskTemplateHandler("Value")
            )

TaskTemplate(Kendo.Mvc.UI.TemplateBuilder)

The template used to render the gantt tasks.The fields which can be used in the template are the task fields

Parameters

template - TemplateBuilder<TModel>

A Template component that configures the tasktemplate.

Toolbar(System.Action)

If a String value is assigned to the toolbar configuration option, it will be treated as a single string template for the whole Gantt Toolbar, and the string value will be passed as an argument to a kendo.template() function.If a Function value is assigned (it may be a kendo.template() function call or a generic function reference), then the return value of the function will be used to render the Gantt Toolbar contents.If an Array value is assigned, it will be treated as the list of commands displayed in the Gantt Toolbar. Commands can be custom or built-in ("append", "pdf", "plannedTasks").The "append" command adds a new task to the gantt.The "pdf" command exports the gantt in PDF format.The "plannedTasks" command will render the plannedTasks Switch on the Toolbar. That Switch allows the user to turn on and off the Planned vs. Actual view in the Timeline of the Gantt. When turned on, that view will render both the planned and the actual duration of all tasks. When enabled, plannedStart and plannedEnd date fields of tasks are required to properly render planned duration.

Parameters

configurator - System.Action<GanttToolbarFactory>

The action that configures the toolbar.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Toolbar(t => t.Add().Name("name"))
            )

Tooltip(System.Action)

The task tooltip configuration options.

Parameters

configurator - System.Action<GanttTooltipSettingsBuilder>

The action that configures the tooltip.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Tooltip(t=>t.Template("template"))
            )

Views(System.Action)

The views displayed by the Gantt and their configuration. The array items can be either objects specifying the view configuration or strings representing the view types (assuming default configuration). By default the Kendo UI Gantt widget displays "day", "week", and "month" views.

Parameters

configurator - System.Action<GanttViewFactory>

The action that configures the views.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .Views(v => v.DayView(dv => dv.Date(DateTime.Now)))
            )

RowHeight(System.Double)

The height of the table rows. Numeric values are treated as pixels.

Parameters

value - System.Double

The value that configures the rowheight.

Example


            @(Html.Kendo().Gantt<TaskViewModel, DependencyViewModel>()
                .Name("gantt")
                .RowHeight(25)
            )

Events(System.Action)

Configures the client-side events.

Parameters

configurator - System.Action<GanttEventBuilder>

The client events action.

Example


            @(Html.Kendo().Gantt()
                .Name("Gantt")
                .Events(events => events
                    .DataBinding("onDataBinding")
                )
            )

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);  
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with Kendo.Mvc.UI.Fluent.WidgetFactory.DeferredScripts(System.Boolean)

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsChildComponent()

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?