Dependencies issue in Gantt

6 posts, 1 answers
  1. Dmitry
    Dmitry avatar
    17 posts
    Member since:
    Oct 2014

    Posted 16 Feb 2015 Link to this post

    Hello, I have an issue with displaying dependencies.
    Not working example is here: http://dojo.telerik.com/alifO/5

    First task and Second task are dependent ones, but no dependency is displayed in Gantt.

    How to provide dependencies as java script array in correct way?

    Script code:
    var _dependencies = new kendo.data.GanttDependencyDataSource({
          schema: {
              model: {
                  id: "id",
                  fields: {
                      id: { from: "id", type: "string" },
                      predecessorId: { from: "predecessorId", type: "string" },
                      successorId: { from: "successorId", type: "string" },
                      type: { from: "type", type: "number" }
                  }
              }
          }
      });
      var _deps = [{"id":1,"predecessorId":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_7","successorId":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_8","type":1}];
    _dependencies.data = _deps;
      $("#gantt").kendoGantt({
          dataSource: new kendo.data.GanttDataSource({
              data: [{"id":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_1","title":"Deploy solution","start":"2015-02-08T22:00:00.000Z","end":"2015-02-26T22:00:00.000Z","percentComplete":0.1},{"id":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_2","title":"Test deployed solution","start":"2015-02-27T22:00:00.000Z","end":"2015-03-01T22:00:00.000Z"},{"id":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_3","title":"Move solution to staging","start":"2015-03-02T22:00:00.000Z","end":"2015-03-17T22:00:00.000Z","percentComplete":0.5},{"id":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_7","title":"First task","start":"2015-02-07T22:00:00.000Z","end":"2015-02-09T22:00:00.000Z","percentComplete":0.15},{"id":"5003d0fb-c6e9-4ddd-aaca-f9871eb51d30_8","title":"Second task","start":"2015-02-10T22:00:00.000Z","end":"2015-02-14T22:00:00.000Z","percentComplete":0.58},{"id":"1010b897-cc7f-41be-b2d6-d464345abc05_1","title":"2 Move solution to new site collection","start":"2015-02-08T22:00:00.000Z","end":"2015-02-19T22:00:00.000Z"},{"id":"1010b897-cc7f-41be-b2d6-d464345abc05_2","title":"2 Test moved site collection","start":"2015-02-02T22:00:00.000Z","end":"2015-02-25T22:00:00.000Z"}],
              schema: {
                  model: {
                      id: "id",
                      fields: {
                          id: { from: "id", type: "string" },
                          parentId: { from: "parentId", type: "string", defaultValue: null },
                          start: { from: "start", type: "date" },
                          end: { from: "end", type: "date" },
                          title: { from: "title", defaultValue: "", type: "string" },
                          percentComplete: { from: "percentComplete", type: "number" }
                      }
                  }
              }
          }),
          dependencies: _dependencies,
          views: ["day", "week", {type:"month", selected:true}]
      });
  2. Answer
    Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 16 Feb 2015 Link to this post

    Hello,

    You have to place the array definition in the DependencyDataSource constructor:
    http://dojo.telerik.com/alifO/5

    Regards,
    Bozhidar
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Piotr
    Piotr avatar
    15 posts
    Member since:
    Feb 2015

    Posted 13 Apr 2015 in reply to Bozhidar Link to this post

    Hi, I do not want to create a new topic so I ask my question here.
    I have an issue with creating Gantt chart. Here is my code

    var _dependencies = new kendo.data.GanttDependencyDataSource({
                    schema: {
                        model: {
                            id: "Id",
                            fields: {
                                id: { from: "Id", type: "number" },
                                predecessorId: { from: "PredecessorId", type: "number" },
                                successorId: { from: "SuccessorId", type: "number" },
                                type: { from: "Type", type: "number" }
                            }
                        }
                    },
                    data: [
                        { "Id": 10, "PredecessorId": 41, "SuccessorId": 39, "Type": 1 },
                        { "Id": 11, "PredecessorId": 41, "SuccessorId": 40, "Type": 1 },
                        { "Id": 12, "PredecessorId": 42, "SuccessorId": 41, "Type": 1 },
                        { "Id": 13, "PredecessorId": 45, "SuccessorId": 42, "Type": 1 },
                        { "Id": 14, "PredecessorId": 45, "SuccessorId": 43, "Type": 1 },
                        { "Id": 15, "PredecessorId": 45, "SuccessorId": 44, "Type": 1 }
                    ]
                });

                $("#gantt").kendoGantt({
                    dataSource: new kendo.data.GanttDataSource({
                        data: [
                            { "Id": 39, "Title": "1", "Start": "2015-04-13T12:04:31.8033817+02:00", "End": "2015-04-15T10:00:00", "PercentComplete": 0 },
                            { "Id": 40, "Title": "2", "Start": "2015-04-13T12:04:31.8523845+02:00", "End": "2015-04-15T17:00:00", "PercentComplete": 0 },
                            { "Id": 41, "Title": "3", "Start": "2015-04-13T12:04:31.8643852+02:00", "End": "2015-04-16T00:00:00", "PercentComplete": 0 },
                            { "Id": 42, "Title": "4", "Start": "2015-04-13T12:04:31.8673854+02:00", "End": "2015-04-19T00:00:00", "PercentComplete": 0 },
                            { "Id": 43, "Title": "5", "Start": "2015-04-13T12:04:31.8683854+02:00", "End": "2015-04-17T00:00:00", "PercentComplete": 0 },
                            { "Id": 44, "Title": "6", "Start": "2015-04-13T12:04:31.8803861+02:00", "End": "2015-04-19T16:00:00", "PercentComplete": 0 },
                            { "Id": 45, "Title": "7", "Start": "2015-04-15T12:04:31.8923868+02:00", "End": "2015-04-19T17:00:00", "PercentComplete": 0 }
                        ],
                        schema: {
                            model: {
                                id: "Id",
                                fields: {
                                    id: { from: "Id", type: "number" },
                                    parentId: { from: "ParentId", type: "number", defaultValue: null },
                                    start: { from: "Start", type: "date" },
                                    end: { from: "End", type: "date" },
                                    title: { from: "Title", defaultValue: "", type: "string" },
                                    percentComplete: { from: "PercentComplete", type: "number" }
                                }
                            }
                        }
                    }),
                    dependencies: _dependencies,
                    views: ["day", "week", { type: "month", selected: true }]
                });

    Dependencies don't work. Am I missing something here? Please help.

    Regards.
  5. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 13 Apr 2015 Link to this post

    Hello,

    In your datasource declarations, you set the model id to the field in the database, instead of the id field. Here's how it should be declared:
    model: {
        id: "id",
        fields: {
            id: { from: "Id", type: "number" },
            predecessorId: { from: "PredecessorId", type: "number" },
            successorId: { from: "SuccessorId", type: "number" },
            type: { from: "Type", type: "number" }
        }
    }

    The same is true for the tasks datasource. Here's the updated working sample:
    http://dojo.telerik.com/alifO/18


    Regards,
    Bozhidar
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Piotr
    Piotr avatar
    15 posts
    Member since:
    Feb 2015

    Posted 14 Apr 2015 in reply to Bozhidar Link to this post

    Thanks for answer. Now i have another issue with parent tasks. I have this structure:

     $("#gantt").kendoGantt({
                        dataSource: new kendo.data.GanttDataSource({
                            data: [
    {"Id":52,"ParentId":null,"Title":"1","Start":"2015-04-14T09:56:00","End":"2015-04-15T11:00:00","PercentComplete":0},
    {"Id":53,"ParentId":null,"Title":"2","Start":"2015-04-15T10:06:00","End":"2015-04-17T00:00:00","PercentComplete":0},
    {"Id":54,"ParentId":null,"Title":"3","Start":"2015-04-17T10:06:00","End":"2015-04-17T17:00:00","PercentComplete":0},
    {"Id":59,"ParentId":55,"Title":"4.1","Start":"2015-04-14T12:40:00","End":"2015-04-18T00:00:00","PercentComplete":0},
    {"Id":60,"ParentId":55,"Title":"4.2","Start":"2015-04-14T12:40:00","End":"2015-04-18T00:00:00","PercentComplete":0},
    {"Id":55,"ParentId":null,"Title":"4","Start":"2015-04-14T10:07:00","End":"2015-04-18T16:00:00","PercentComplete":0},
    {"Id":56,"ParentId":null,"Title":"5","Start":"2015-04-14T10:07:00","End":"2015-04-18T15:00:00","PercentComplete":0},
    {"Id":57,"ParentId":null,"Title":"6","Start":"2015-04-14T10:08:00","End":"2015-04-19T17:00:00","PercentComplete":0},
    {"Id":58,"ParentId":null,"Title":"7","Start":"2015-04-14T10:11:00","End":"2015-04-19T00:00:00","PercentComplete":0}
    ],
                            schema: {
                                model: {
                                    id: "id",
                                    fields: {
                                        id: { from: "Id", type: "number" },
                                        parentId: { from: "ParentId", type: "number", defaultValue: null },
                                        start: { from: "Start", type: "date" },
                                        end: { from: "End", type: "date" },
                                        title: { from: "Title", defaultValue: "", type: "string" },
                                        percentComplete: { from: "PercentComplete", type: "number" }
                                    }
                                }
                            }
                        }),
                        dependencies: {
                            schema: {
                                model: {
                                    id: "id",
                                    fields: {
                                        id: { from: "Id", type: "number" },
                                        predecessorId: { from: "PredecessorId", type: "number" },
                                        successorId: { from: "SuccessorId", type: "number" },
                                        type: { from: "Type", type: "number" }
                                    }
                                }
                            },
                            data: [
    {"Id":126,"PredecessorId":52,"SuccessorId":53,"Type":1},
    {"Id":127,"PredecessorId":53,"SuccessorId":54,"Type":1},
    {"Id":128,"PredecessorId":55,"SuccessorId":54,"Type":1},
    {"Id":129,"PredecessorId":54,"SuccessorId":56,"Type":1},
    {"Id":130,"PredecessorId":56,"SuccessorId":57,"Type":1},
    {"Id":131,"PredecessorId":58,"SuccessorId":57,"Type":1}
    ]
                        },
                        views: ["day", { type: "week", selected: true }, "month"],
                        editable: false,
                    });

    here is dojo: http://dojo.telerik.com/enUJu

     Tasks 4.1 and 4.2 are children of 4 but the are not displayed in chart. Am I missing something?

    Regards

  7. Bozhidar
    Admin
    Bozhidar avatar
    1101 posts

    Posted 15 Apr 2015 Link to this post

    Hi,

    In order for the parent tasks to be properly initialized and recognized as such, their summary field should be set.

    Here's the modified sample:
    http://dojo.telerik.com/enUJu/2

    And if you want to control the expanded state of each parent, you have to se the expanded field as well.

    Regards,
    Bozhidar
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready