This is a migrated thread and some comments may be shown as answers.

Dependencies Needed?

8 Answers 244 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 22 Aug 2014, 07:07 AM
I have a gantt chart now rendering on my MVC page without error.  I have plumbed in the IQueryable for the Tasks Datasource but have not touched the Dependencies Datasource.  The Gantt is rendering blank.

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

Sort by
0
Richard
Top achievements
Rank 1
answered on 22 Aug 2014, 07:53 AM
Some more info... rather promisingly I have used the Chrome inspector and I can see that the task data has made it to the client and I have an array of data objects which appear properly populated within the Gantt widget.

But still no rendering of the chart.
0
Alex Gyoshev
Telerik team
answered on 22 Aug 2014, 11:50 AM
Hello Richard,

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.

 
0
Richard
Top achievements
Rank 1
answered on 22 Aug 2014, 01:26 PM
Thanks for this Alex.

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
...and indeed the data seems to be populated in the Gantt widget.

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?
0
Alex Gyoshev
Telerik team
answered on 25 Aug 2014, 02:13 PM
Hello Richard,

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.

 
0
Richard
Top achievements
Rank 1
answered on 26 Aug 2014, 07:53 AM
Thanks Alex.

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
0
Alex Gyoshev
Telerik team
answered on 26 Aug 2014, 12:13 PM
Hello 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.

 
0
Richard
Top achievements
Rank 1
answered on 28 Aug 2014, 07:05 PM
This was subsequently solved.

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.
0
Jason
Top achievements
Rank 1
answered on 01 Sep 2014, 01:16 PM
Thanks for the follow up, Richard.
Tags
Gantt
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Alex Gyoshev
Telerik team
Jason
Top achievements
Rank 1
Share this question
or