updating predecessors does not work.Help

good evening.
I am testing the gantt chart with javascript and with the event below:

  taskbarEdited: function (args) {args.roundOffDuration = true;
 var id = args.data.taskId;
   var start = args.data.startDate;
    var fim = args.data.endDate;
    var predecessors = args.data.dependencia;
                  // save changes to the database
                  sendData (id, start, end, predecessors);
              },


I can update in my database.

Now, how do I update dependencies when I drag? The variable predecessor is bringing nothing.

 I need to know what kind of dependency it is and the ID of the predecessor to write to the database.

I also noticed that the model updates the dates automatically when I drag a dependency. I need to get the ids and dates where these changes occurred after dragging a dependency. How do I do that? What event?

Thanks.

ps I am loving the tool.
(.br)

5 Replies 1 reply marked as answer

MS Monisha Sivanthilingam Syncfusion Team July 10, 2020 06:56 AM UTC

Hi Carmem, 
Thank you for contacting Syncfusion support. 
 
In the taskbarEdited event, we can get the changes of dragged record of scheduled values. Hence, we would like to suggest you that complete modified records collection can be gotten on the actionComplete event by the request type of save  from modifiedTaskData arguments. Because, when we change the child record's scheduling then it may also affect it's parent and dependency connected records' scheduling values. 
 
The following code snippet demonstrates how to achieve this. 
 
actionComplete: function (args) { 
                if (args.requestType === "save") { 
                    for (var i = 0; i < args.modifiedTaskData.length; i++) { 
                        var id = args.modifiedTaskData[i].TaskId; 
                        var start = args.modifiedTaskData[i].StartDate; 
                        var end = args.modifiedTaskData[i].EndDate; 
                        var predecessors = args.modifiedTaskData[i].Predecessor; 
                        //save changes to the database 
                        sendData(id, start, end, predecessors); 
                    } 
                } 
            } 
                                                                                                                                            
We have also attached a sample demonstrating this. 
 
Regards, 
Monisha. 


Marked as answer

CA CARMEM July 10, 2020 06:57 PM UTC


Good afternoon Thank you for responding. I'll do the tests and let you know if they worked. Thank you very much


GM Gopinath Muniraj Syncfusion Team July 13, 2020 10:20 AM UTC

Hi Carmem,   
 
Thanks for the update. 
We will wait until we hear from you. 
 
   
Regards,  
Gopinath M 



AG Ankur Gathia June 2, 2023 11:37 AM UTC

Hello,


If there are two task Task A and Task B

task A is connected with Task B


now I am changing value of Task A It should be option to get updated predecessot with offset for Task B.


How to save my data of Task B when I changes Task A Date?


In your example in actionCompleted Modified records contain only seelcted task A records





UA Udhayakumar Anand Syncfusion Team June 5, 2023 03:48 PM UTC

Hi Ankur,


Upon reviewing your inquiry, we have attached video where the duration of task 1 was edited. In the "actionComplete" event, you will find two records inside the modifiedRecords. This scenario occurs specifically when changes made to task 1 affect task 2, such as alterations to its duration or end date In this way you can get the second record value. In order for us to proceed with further validation, kindly provide us with the following information:


  1. Which field that you’re editing
  2. Any other customization that you’ve used in gantt
  3. Detailed Explanation of your requirement
  4. Exact steps to replicate the issue
  5. Could you modify the given sample and replicate the issue, which will be helpful for us to validate further


Sample Link : https://stackblitz.com/edit/mt28s8?file=index.ts,data-source.ts


Regards,

Udhayakumar


Loader.
Up arrow icon