Hello,
Could you share some of your backend code and some basic info, such as what libraries you use, do you see any errors coming from a backend when you create links, etc. ?
I might be looking for something similar: I would like to extend the link object with more data when calling ‘onAfterLinkAdd’. The gantt chart I’m trying to create is generated from multiple DB tables and to link dependencies, I need to determine what table the ‘task’ is in and what table the ‘dependency’ is in.
The multiple tables is due to project/task tables and also a maintenance table that all scheduled maintenances get created in. These maintenances can be assigned to a project and tasks can be dependent on their successful completion, sort of like a milestone, I guess.
My code for the ‘onAfterLinkAdd’ is:
gantt.attachEvent("onAfterLinkAdd", function(id, link){
if (link['type'] != "0") {
toastr['warning']("This link type is not allowed at this time.", "Link Fail")
gantt.deleteLink(link['id'])
} else {
post_data = {}
post_data['dependency'] = link['source']
post_data["project_id"] = {{project.id}}
post_data['task'] = link['target']
$.post('<url>', post_data, function(data){
toastr[data.type](data.message, data.title) //alerting system
})
}
});
I would like to add ‘db_type’ to the ‘post_data’ but even in the received json I get when I build the gantt chart, the added fields aren’t added to the div’s.