Hello,
This is My gantt config Object
$scope.ganttOptions = {
dataSource: tasksDataSource,
views: ["day",{type: "week", selected: true},"month"],
footer: false,
columns: [
{field: "title", title: "Title", editable: true},
{field: "assignedTo", title: "Assigned To", editable: true}
],
toolbar: [
{name: "append"},
{name: "pdf"}
],
height: 400,
add:addTask
}
How to add Custom Task and Highlight it?
I am using this function
function addTask(e){
var number= Math.floor((Math.random() * 5000) + 1);
e.preventDefault()
if(e.task.parentId){
var customTaskObject = {
"id": number,
"parentId":e.task.parentId,
"title": "Sample Child Task",
"start": e.task.start,
"end": e.task.end,
"summary": false,
"expanded": true,
"PercentComplete":"",
"originalTaskObject":"",
"orderId": e.task.orderId
}
}
else{
console.log("No Parent Selected")
parentTaskId=0;
var customTaskObject = {
"id": number,
"parentId":null,
"title": "Sample Task",
"start": e.task.start,
"end": e.task.end,
"summary": false,
"expanded": true,
"PercentComplete":"",
"originalTaskObject":"",
"orderId": e.task.orderId,
}
$scope.gantt.dataSource.add(customTaskObject)
}
The Above code is adding the Task only in the last position even after selecting "Add Above" option.
What is the issue here? and how to highlight the latest added task (I tried Select method by getting index value..but it is not highlighting the correct task).
PS:Without e.preventDefault() method it is working absolutely fine,but i want to add Task through controller with custom field names.