Hi, we would like to be able to display a message each time a user tries to modify a task and the change is reverted back by the scheduling engine because it is not compatible with the other existing constraints.
Example :
Task A is scheduled from 20/04/2021 to 22/04/2021
Task B is scheduled as successor to task A and has a contraint 'start no later than' 26/04/2021
Capture.PNG (43.05 KiB) Viewed 970 times
If we try to set the Task A start date (via the column) to 28/04/2021, it is reverted back.
Same if we drag the Task A on the gantt chart and position it to start the 28/04/2021.
In both cases, the Task B constraint could not be respected, so the change was reverted.
How can we detect this to display a message to the user with some explanations ?
We don't yet have the conflict resolution UI yet but it's coming, for now you can do:
// Track scheduling conflicts happened
project.on("schedulingconflict", context => {
// show notification to user
Toast.show(
"Scheduling conflict has happened ..recent changes were reverted"
);
// as the conflict resolution approach let's simply cancel the changes
context.continueWithResolutionResult(
bryntum.gantt.EffectResolutionResult.Cancel
);
});
Thanks for the code sample but it throws JS errors when we try to use it :
JS Errors.PNG (67.63 KiB) Viewed 951 times
Moreover, the listener is not always triggered.
For example, if we set a 'must start on' constraint on a task and we try to modify the start date via the column and press enter, then the start date is automatically reverted back to its original value without triggering the 'schedulingConflict' event.
Is there any way to know that a change has been automatically reverted ? We just want to inform the user that it is not a bug, but an automatic correction because the change was not possible.
Ok, this event is not triggered in all the cases we want to cover anyway.
For example, if we set a 'must start on' constraint on a task and we try to modify the start date via the column and press enter, then the start date is automatically reverted back to its original value without triggering the 'schedulingConflict' event.
Is there any way to know that a change has been automatically reverted ?
We just want to inform the user that it is not a bug, but an automatic correction because the change was not possible.
That's the only and the correct way to do that. It will be triggered when we release the fix for this issue - I just checked it in the branch with the fix. You could subscribe on the ticket updates to be notified when it's ready https://github.com/bryntum/support/issues/2766