This is a migrated thread and some comments may be shown as answers.
Gantt Orderid, summary and parent id after reordering tasks
7 Answers 19 Views
This is a migrated thread and some comments may be shown as answers.
Vaishali
Top achievements
Rank 1
Vaishali asked on 25 Aug 2019, 05:39 PM

Hi,

I am working on gantt somewhat like this: https://dojo.telerik.com/UneJeBOd. All the data is in memory and all changes are to be handled locally and at the end sent to db to save. Now, when the tasks are dragged around to make it as subtask and to change the ordering, how to capture all the tasks that are effected. How for e.g, if Task3 is moved under task2. Task 2 becomes summary task. How to catpure that change?

2. If I move task 3 above task1, the orderid for both task1 and task3 changes, how to capture that.

Thanks

 

7 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 27 Aug 2019, 12:49 PM

Hello Vaishali,

Concerning the changed order, you could get the new orderId of the task being edited by using a timeouted function in the save event:

save: function(e) {
  setTimeout(function() {
    console.log(e);
  	console.log(e.task.orderId);
  });
}

As per any updated on the parent tasks which change their state from/to summary, you could track for changes in the parentId field similarly to the above:

save: function(e) {
  console.log(e.values);
  console.log(e.task.parentId);
  
  setTimeout(function() {
    console.log(e.task.parentId);
  });
}

Note that the e.values field of the event arguments object will contain all the changed fields for the Task that has been moved.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vaishali
Top achievements
Rank 1
answered on 27 Aug 2019, 03:40 PM
e.values gives values of the task that has changed. I am looking for the order ids of other tasks changed due to this task orderid changing. Is there any way to get that?
0
Veselin Tsvetanov
Telerik team
answered on 28 Aug 2019, 08:17 AM

Hello Vaishali,

The save event would allow you to identify the old and the new Parent ID if a change of the parent occurs:

save: function(e) {
  var newParentId = e.values.parentId;
  
  if (newParentId !== e.task.parentId) {
    console.log("Old parent ID is: " + e.task.parentId);
    console.log("New parent ID is: " + newParentId);
  }
}

This way you will be able to access the old/new parent task and track for changes of its state.

As per the changes in the orderIds of the other tasks, I am afraid that those could not be tracked.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vaishali
Top achievements
Rank 1
answered on 28 Aug 2019, 01:29 PM
Hi, in the response you are still talking about the task that was moved. I need to know about other tasks that were affected because of that move. For eg
Task1 orderid 0 summary true parentid null
Task2 orderid 0 summary false parentid 1
Task3 orderid 1 summary false parentid null

Now, I move task 2 out of task 1, so task2 parentid becomes 1, I can get that change from Save event.

I want to get the changes that happened in task 1 and task3. The task1 summary becomes false, and task3 orderid becomes 2. How do i capture these changes?
0
Veselin Tsvetanov
Telerik team
answered on 30 Aug 2019, 09:50 AM

Hi Vaishali,

You are correct that in case there is a change in the orderId of a different task (not the actual one that has been moved), you won't be able to get that info. Nevertheless, if there is a change of the parent, you could identify the Id of the previous and the new parent. Having the Ids will allow you to retrieve the tasks themselves:

save: function(e) {
  var newParentId = e.values.parentId;
  var oldParentId = e.task.parentId;
  var dataSource = e.sender.dataSource;

  if (newParentId !== oldParentId) {
    console.log("Old parent ID is: " + oldParentId);
    
    var oldParentSummaryBeforeChange = dataSource.get(oldParentId).summary;
    console.log("Old parent is summary before change: " + oldParentSummaryBeforeChange);
    
    console.log("New parent ID is: " + newParentId);
    
    var newParentSummaryBeforeChange = dataSource.get(newParentId).summary;
    console.log("New parent is summary before change: " + newParentSummaryBeforeChange);
    
    setTimeout(function() {
    	var oldParentSummaryAfterChange = dataSource.get(oldParentId).summary;
      console.log("Old parent is summary after change: " + oldParentSummaryAfterChange);

      var newParentSummaryAfterChange = dataSource.get(newParentId).summary;
      console.log("New parent is summary after change: " + newParentSummaryAfterChange);
    });
  }
}

Here you will find a modified version of the Dojo sample implementing the above.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Vaishali
Top achievements
Rank 1
answered on 30 Aug 2019, 01:38 PM
Thanks for your response. This is still limited to the task that moved. If we move the task with the parent change, we wont be able to track the order ids. In example here https://demos.telerik.com/kendo-ui/gantt/index, all changes are still updated via the transport.update. Anyway we have any event where we can capture this, instead of directly calling the update endpoint.
0
Veselin Tsvetanov
Telerik team
answered on 02 Sep 2019, 10:09 AM

Hello Vaishali,

Yes, that is correct, neither the save event nor any other event of the Gantt will allow you to capture any changes of the orderId for an event, which has not been directly moved. As you have correctly noticed, handling the transport.update action would be the only possible solution in this case.

Regards,
Veselin Tsvetanov
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Gantt
Asked by
Vaishali
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Vaishali
Top achievements
Rank 1
Share this question
or