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

task's and dependency's ids type

4 Answers 95 Views
Gantt
This is a migrated thread and some comments may be shown as answers.
petr
Top achievements
Rank 1
petr asked on 08 Apr 2015, 06:00 PM

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.

4 Answers, 1 is accepted

Sort by
0
Bozhidar
Telerik team
answered on 09 Apr 2015, 08:26 AM
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!
 
0
petr
Top achievements
Rank 1
answered on 09 Apr 2015, 12:39 PM

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 .. 

0
petr
Top achievements
Rank 1
answered on 09 Apr 2015, 01:59 PM

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" }

 

 

0
Bozhidar
Telerik team
answered on 10 Apr 2015, 06:53 AM
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!
 
Tags
Gantt
Asked by
petr
Top achievements
Rank 1
Answers by
Bozhidar
Telerik team
petr
Top achievements
Rank 1
Share this question
or