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

Populating Gantt via Services

1 Answer 50 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 20 Aug 2014, 08:09 AM
Having learnt that Gantt doesn't (yet) support passing models to views I am attempting to engineer a datasource/service driven Gantt chart.

View is:
<div class="gantt-wrapper">
    @(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.Read(Function(read) read.Action("ReadTasks", "Gantt")).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)            
                                                                                                                End Sub)))
</div>

The following is rendered but no gantt chart is displayed:
<div class="gantt-wrapper">
    <div data-role="gantt" id="gantt"></div><script>
    jQuery(function(){jQuery("#gantt").kendoGantt({"columns":[{"title":"ID","width":50,"sortable":true,"field":"ID"},{"title":"Project Name","editable":true,"sortable":true,"field":"title"},{"title":"Start Time","format":"{0:MM/dd/yyyy}","width":100,"editable":true,"sortable":true,"field":"start"},{"title":"End Time","format":"{0:MM/dd/yyyy}","width":100,"editable":true,"sortable":true,"field":"end"}],"views":[{"type":"day"},{"selected":true,"type":"week"},{"type":"month"}],"dataSource":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":"/Gantt/ReadTasks"},"prefix":""},"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"id":"ID","fields":{"ID":{"type":"number"},"title":{"from":"Title","type":"string"},"start":{"from":"Start","type":"date"},"end":{"from":"End","type":"date"},"parentId":{"from":"ParentID","type":"number"},"orderId":{"from":"OrderID","type":"number"},"percentComplete":{"from":"PercentComplete","type":"number"},"expanded":{"from":"Expanded","type":"boolean"},"summary":{"from":"Summary","type":"boolean"}}}}},"dependencies":{"type":(function(){if(kendo.data.transports['aspnetmvc-ajax']){return 'aspnetmvc-ajax';} else{throw new Error('The kendo.aspnetmvc.min.js script is not included.');}})(),"transport":{"read":{"url":""},"prefix":""},"schema":{"data":"Data","total":"Total","errors":"Errors","model":{"fields":{"DependencyID":{"type":"number"},"PredecessorId":{"type":"number"},"SuccessorId":{"type":"number"},"Type":{"type":"number"}}}}}});});
</script>
</div>
        </div>

The controller datasource service is not being called (no breakpoints are hit).  Any help gratefully received!
Thanks

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 21 Aug 2014, 08:01 AM
SELF SOLVED!

Inspecting javascript errors revealed that the upgrade to 2014Q2 had not populated the files in my project.

I now have a gantt chart (albeit blank)!

Sorry for the self-induced confusion.
R.
Tags
Gantt
Asked by
Richard
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or