Task 1.2.2 when outdented it sends update event for this task only without updating rest of below tasks ending in duplicate wbs
you can use this project : Outdent Issue
Support Forum
- Attachments
-
- Outdent Task.mp4
- (1.37 MiB) Downloaded 10 times
Like in your other similar post, this error is caused by salesforce when you're trying to call Salesforce API. I don't know what is the problem there, however when looking at your event listeners I notices few things you should not do.
Here in the update listener, you take one field and assign it to another field, triggering another update and another handler.
getFlatTasks(records) {
let flatTasks = [];
for (let record of records) {
record.wbs = record.wbsCode;// here
flatTasks.push(record); //{id:record.id}
if (record.children) {
flatTasks.push(...this.getFlatTasks(record.children));
}
record.children = [];//and here
}
return flatTasks;
}
// This method should be smth like this
getFlatTasks(records) {
let flatTasks = [];
for (let record of records) {
const output = Object.assign({}, record, {
wbs: record.wbsCode,
children: []
});
flatTasks.push(output); //{id:record.id}
if (record.children) {
flatTasks.push(...this.getFlatTasks(record.children));
}
}
return flatTasks;
}
you should fix the update trigger to send the affected tasks
What do you mean by update
trigger? By design, update event is triggered for every individual record update: https://bryntum.com/products/gantt/docs/api/Core/data/Store#event-update
If can use different API to get set of changes. hasChanges
event to know when data is changed: https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#event-hasChanges and changes API to get set of changes from the project model: https://bryntum.com/products/gantt/docs/api/Gantt/model/ProjectModel#property-changes
gantt.project.on({ hasChanges() {
// read changes here, sync them
sync(project.changes)
})