Dependencies Needed?

9 posts, 0 answers
  1. Richard
    Richard avatar
    18 posts
    Member since:
    Jun 2014

    Posted 22 Aug 2014 Link to this post

    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
  2. Richard
    Richard avatar
    18 posts
    Member since:
    Jun 2014

    Posted 22 Aug 2014 in reply to Richard Link to this post

    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.
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 22 Aug 2014 Link to this post

    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.

     
  5. Richard
    Richard avatar
    18 posts
    Member since:
    Jun 2014

    Posted 22 Aug 2014 in reply to Alex Gyoshev Link to this post

    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?
  6. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 25 Aug 2014 Link to this post

    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.

     
  7. Richard
    Richard avatar
    18 posts
    Member since:
    Jun 2014

    Posted 26 Aug 2014 in reply to Alex Gyoshev Link to this post

    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
  8. Alex Gyoshev
    Admin
    Alex Gyoshev avatar
    2500 posts

    Posted 26 Aug 2014 Link to this post

    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.

     
  9. Richard
    Richard avatar
    18 posts
    Member since:
    Jun 2014

    Posted 28 Aug 2014 in reply to Alex Gyoshev Link to this post

    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.
  10. Jason
    Jason avatar
    9 posts
    Member since:
    Jan 2009

    Posted 01 Sep 2014 Link to this post

    Thanks for the follow up, Richard.
Back to Top
UI for ASP.NET MVC is VS 2017 Ready