I’m new to all of this. I trie to use Dhtmxl Ganttchart (jquery) as a project-tool. There is no problem in retrieving data from models but when i make changes i dont know how to save them back into SF.
var element = argumentst0], $ = skuid.$;
element.html(‘
’);$(document).ready( function() {
var omrModel = skuid.model.getModel(‘Omrade’);
var omrId = omrModel.dataM0].Id;
console.log(omrId);
var omrTask = {id: omrId, text: omrModel.dataM0].Name, open: true, type:“project”, /color: “colorcode”/};
console.log (omrTask);
var doModel = skuid.model.getModel(‘Delomraden’);
var doTasks = ;
doTasks.push(omrTask);
var aoModel = skuid.model.getModel(‘AO’);
$.each(doModel.data, function (i, doRow){
console.log(doRow.Name);
doTasks.push({id: doRow.Id, text: doRow.Name, open: true, type:“project”, parent: omrId});
doTasks.push({id: ‘P’ + doRow.Id, text: 'Projektering: ’ + doRow.Name, start_date: doRow.Start_projektering__c, end_date: doRow.Slut_projektering__c, open: true, type:“task”, progress: doRow.Projektering_klar_p__c, parent: doRow.Id});
console.log(doRow.Start_projektering__c);
doTasks.push({id: ‘I’ + doRow.Id, text: 'Installation: ’ + doRow.Name, start_date: doRow.Start_kundinstallation__c, end_date: doRow.Slut_kundinstallation__c, open: true, type:“task”, progress: doRow.Kundinstallation_klar_p__c, parent: doRow.Id});
doTasks.push({id: ‘S’ + doRow.Id, text: 'Stam: ’ + doRow.Name, open: true, type:“project”, parent: doRow.Id});
$.each(aoModel.data, function (j, aoRow){
if(aoRow.Delomrade__c == doRow.Id) {
console.log(aoRow.Name);
doTasks.push({id: aoRow.Id, text: aoRow.Name, start_date: aoRow.Planerad_start__c, end_date: aoRow.Planerad_klart__c, open: true, type:“task”, parent: ‘S’ + doRow.Id /color: aoRow_color__c/});
}
});
});
console.log(doTasks);
var omrData = {
data:
doTasks
}
var sampData = {
data:
omrTask,
doTaskst0],
doTasks 1],
doTasks
2],
doTasks
3],
{id:1, text:"Project #1", open: true, type:"project"},
{id:2, text:"Task #1", start_date:"2015-03-05", duration:5, progress: 1, open: true, parent:1},
{id:3, text:"Task #2", start_date:"2015-03-07", duration:7, progress: 0.5, open: true, parent:1},
{id:4, text:"Task #2.1", start_date:"2015-03-08", duration:2, progress: 1, open: true, parent:3, color: "red"},
{id:5, text:"Task #2.2", start_date:"2015-03-10", duration:3, progress: 0.8, open: true, parent:3, color: "red"},
{id:6, text:"Task #2.3", start_date:"2015-03-11", duration:4, progress: 0.2, open: true, parent:3, color: "red"}
],
links:2
{id:1, source:1, target:2, type:"1"},
{id:2, source:1, target:3, type:"1"},
{id:3, source:3, target:4, type:"1"},
{id:4, source:4, target:5, type:"0"},
{id:5, source:5, target:6, type:"0"},
{id:6, scurce:6, target:7, type:"0"}
]
}
myGantt = $("#gantt_omr").dhx_gantt({
xml_date: "%Y-%m-%d",
scale_unit: "week"
});
myGantt.parse(omrData);
// $("#gantt_omr").dhx_gantt().parse(omrData).config.xml_date("%Y-%m-%d");
});