Hello,
i’m trying to insert data from javascript into my gantt chart.
The data is created like that:
initializeGantt : function(data)
{
var tasks = new Array();
for (var i = 0; i < data.length; i++)
{
var obj = {
id : i + 1,
text : data[i].text,
duration : data[i].duration,
start_date : data[i].start_date
};
tasks.push(obj);
}
var o = {
data : tasks
};
gantt.parse(o);
}
The resulting object looks like that converted to json:
{
"data":[
{
"id":1,
"text":"Task 1",
"duration":24,
"start_date":"13-10-2014"
},
{
"id":2,
"text":"Task 2",
"duration":30,
"start_date":"13-10-2014"
},
{
"id":3,
"text":"Task 3",
"duration":36,
"start_date":"13-10-2014"
},
{
"id":4,
"text":"Task 4",
"duration":120,
"start_date":"13-10-2014"
},
{
"id":5,
"text":"Task 5",
"duration":0,
"start_date":"13-10-2014"
},
{
"id":6,
"text":"Task 6",
"duration":0,
"start_date":"13-10-2014"
},
{
"id":7,
"text":"Task 7",
"duration":0,
"start_date":"13-10-2014"
},
{
"id":8,
"text":"Task 8",
"duration":0,
"start_date":"13-10-2014"
}
]
}
What am I doing wrong here?
Thanks for any help