Hello,
I ran into some issues with the DateConstraint feature. This issue appears in both the Gantt and the SchedulerPro. And it is reproducable in the basic Gantt demo.
In the basic react demo, I added the following to the ganttConfig:
getDateConstraints: (taskRecord) => {
console.log("gantt getDateConstraints");
return {
start: new Date(2018,1,20),
end: new Date(2019,1,20),
};
},
When task B is pushed forwards because of a dependency from task A to task B when task A is moved by the user, no validation is done on the date constraint for task B, only on the task that is directly being moved.
If the task edit is opened, and the start or end date is changed in the edit form, the date constraint is not applied.
As a workaround for the previous point, we added a maximum value for the end date of a task on opening the task editor, but the validation does not take place if you type in the date, and immediately press save. The validation only takes place if you click outside of the edit after typing. I also could not find a beforeSave event we could use to force a validation.
The code for setting the min/max dates in the task edit:
taskEditFeature:{
...
listeners: {
beforeShow({ source }) {
if (source.loadedRecord?.nextDependencyStartDate) {
source.widgetMap.endDate.max = source.loadedRecord.nextDependencyStartDate;
}
if (source.loadedRecord?.prevDependencyStartDate) {
source.widgetMap.startDate.min = source.loadedRecord.prevDependencyStartDate;
}
},
}
Is there a better way to use this feature? We have some constraints that are loaded from the server, that the user really should not be able to overwrite in any case.