Hi Support Team,
I want to merge current schedule with the file I imported. this is the data I merged and will load to bryntum gantt:
Here is my ImporterMerge.js
Here is my app.js
In app.js please take a look at line 218:
gantt.crudManager.on('load', function () {
//Call ajax to load data.json and pass to ImporterMerge.js
//This is example of call importer
//await importer.importData(response.data);
//gantt.setStartDate(gantt.project.startDate);
//await gantt.scrollToDate(gantt.project.startDate, { block: 'start' });
});
Let me explain the logic:
First I load bryntum with an empty data
After project loaded it will trigger event "load" of gantt.crudManager. Inside this event I will call ajax to load data, example here I load data.json and pass this data to ImporterMerge.js
In this ImporterMerge.js I do as: tasks imported and already existed in the current schedule I will keep id, tasks imported with no existed with current schedule I will remove id, mean this task will be added new.
To this step everything is ok. Because I checked:
Some tasks need to create new will have isPhantom = true, and id has a string format. Example: "_generatedClassDefEx1"
Some tasks need to update will have id > 0
My problem is when I click Save, all tasks are added new. Please help me take a look at some files I attached and help me why some tasks have id > 0 but when sync, bryntum send them to server inside syncRequest.tasks.added. I think they have to be inside syncRequest.tasks.updated
Note: I used bryntum gantt v4.2.5
Thanks