Does the Gantt chart need the Dependencies Datasource to be wired up?
View:
@(Html.Kendo().Gantt(Of IMS_2.Models.Task, IMS_2.Models.Dependency)().Name("gantt") _
.Columns(Sub(columns)
columns.Bound(Function(c) c.ID).Title("ID").Width(50)
columns.Bound("title").Editable(True).Sortable(True)
columns.Bound("start").Title("Start Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(True).Sortable(True)
columns.Bound("end").Title("End Time").Format("{0:MM/dd/yyyy}").Width(100).Editable(True).Sortable(True)
End Sub) _
.Views(Sub(views)
views.DayView()
views.WeekView(Function(weekView) weekView.Selected(True))
views.MonthView()
End Sub) _
.DataSource(Function(d) d.Model(Sub(m)
m.Id(Function(f) f.ID)
m.ParentId(Function(f) f.ParentID)
m.OrderId(Function(f) f.OrderID)
m.Field(Function(f) f.Expanded).DefaultValue(True)
End Sub) _
.Read("ReadTasks", "Home")
))
Many thanks
8 Answers, 1 is accepted
But still no rendering of the chart.
The dependencies between tasks are not required for the proper visualization of the Gantt. Please make sure that you are processing the Gantt requests on the server as DataSourceRequest, and return a DataSourceResponse. See the getting started help topic for a step-by-step example.
Regards,Alex Gyoshev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
The only event I'm dealing with is the DatasourceRequest:
Public Function ReadTasks(request As DataSourceRequest) As ActionResult
Dim FromDate As DateTime = Now()
Dim ToDate As DateTime = DateAdd(DateInterval.Day, 50, Now())
Dim evts = From e In db.events.Current.Where(Function(x) x.company_id = 5 And x.Completed = 0 And x.date > FromDate And x.date < ToDate)
Join j In db.jobs.Current On j.enquiry_id Equals e.enquiry_id And j.Company_id Equals e.company_id
Select New Models.Task With {.ID = e.enquiry_id, .Title = j.project_name + " - " + e.task_name, .Start = DbFunctions.AddDays(e.date, -1), .End = e.date, .Expanded = False, .OrderID = 1, .PercentComplete = 0, .ParentID = 1072, .Summary = False}
Return Json(evts.ToDataSourceResult(request))
End Function
I'm not using the Dependencies method (so I'm assuming I don't need to handle the associated Request)
Is there anything else I'm missing?
The posted code seems fine, and you don't need to handle dependencies, if your business case does not need them. Are you experiencing any other issues?
Regards,Alex Gyoshev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
That's good to know and it's pleasing to see the datasource working, but I'm not seeing a chart rendered. I have some dates on the timeline so the Gantt clearly recognises some events, but otherwise it's blank - please see attached screenshot.
Any ideas?!
Thanks
Richard
I am afraid that we are out of ideas, based on the screenshot. Please submit a sample project that shows the problem, so that we can provide any insight.
Regards,Alex Gyoshev
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
For reference the main issue was that the parentID should be 'nothing' for at least one task - if not the gantt can't find a 'parent' and renders nothing. Obviously parentID needs to be a nullable integer in the viewmodel.
Dependencies are not needed at all to make the gantt work.