task's and dependency's ids type

5 posts, 0 answers
  1. petr
    petr avatar
    7 posts
    Member since:
    Mar 2015

    Posted 08 Apr 2015 Link to this post

    Hi. 

    Can I use not number type for "id" field for dependencies and tasks? Or It must be number type?

    For exemple guid as  "dbaa0c8b-e188-4e83-8e14-b0b41dd12f0e".

    And this my object for dependency:

    "{

    "id":"dbaa0c8b-e188-4e83-8e14-b0b41dd12f0e",

    "type":1,

    "predecessorId":"01415eab-f852-4cd8-af5e-4be43bba1dc2",

    "successorId":"f13e95f2-402a-4819-8137-3977f31eeb5e"

    }"

     

    Thank you.

  2. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 09 Apr 2015 Link to this post

    Hello,

    The gantt can work with guid. It's treated as a string and should not cause any problems. Here's a small example:
    http://dojo.telerik.com/UnuDU

    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. petr
    petr avatar
    7 posts
    Member since:
    Mar 2015

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

    Ok.

    It   works if GUIDs start with number but what about letter ? For example will change the  '01415eab-f852-4cd8-af5e-4be43bba1dc2'  to  'a1415eab-f852-4cd8-af5e-4be43bba1dc2'  as result tasks does not connect.

    this my example http://dojo.telerik.com/UnuDU .. 

  5. petr
    petr avatar
    7 posts
    Member since:
    Mar 2015

    Posted 09 Apr 2015 in reply to petr Link to this post

    Ok.

    I found a solution.
    We can difine schema for tasks and for dependencies.

    for dependency:

     schema: {
                        model: {
                            id: "id",
                            fields: {
                                id: { from: "dependencyId", type: "string" },
                                type: { from: "type", type: "number"},
                                predecessorId: { from: "predecessorGuidId", type: "string" },
                                successorId: { from: "successorGuidId", type: "string" }
                            }
                        }
                    }

     

    for task :

     schema: {
                        model: {
                            id: "id",
                            fields: {
                                id: { from: "taskId", type: "string" },
                                orderId: { from: "orderId", type: "number", validation: { required: true } },
                                start: { from: "start", type: "date" },
                                end: { from: "end", type: "date" },
                                title: { from: "title", defaultValue: "", type: "string" }

     

     

  6. Bozhidar
    Admin
    Bozhidar avatar
    1102 posts

    Posted 10 Apr 2015 Link to this post

    Hello,

    Yes, defining the schema is the correct approach. You have to also make sure that in your service Insert method you generate and return a new Guid for the task's id. You can also define it as a default value for the field:
    schema: {
        model: {
            id: "id",
            fields: {
                id: { from: "ID", type: "string", defaultValue: kendo.guid() },
                ...
            }
        }
    },


    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