bryntum / support

An issues-only repository for the Bryntum project management component suite which includes powerful Grid, Scheduler, Calendar, Kanban Task Board and Gantt chart components all built in pure JS / CSS / TypeScript
https://www.bryntum.com
54 stars 6 forks source link

Add date constraints for Task start/end date separately #9821

Open chuckn0rris opened 3 months ago

chuckn0rris commented 3 months ago

TaskDrag allow to stop drag animation on some border when drag task. Should be possible to stop it on some border when resize tasks too. In other words when we drag a task, getDateConstraints just stop task bar on the border of prevented area. When we resize task, it doesn't stop on some border, it only possible to validate after drop and revert last change.

Forum post

we have a task from November, 1 to November, 20. And we want to prevent shrinking or moving this task before November, 10. I think we could set the end date constraint just for the end date in this case.

this requirement is not really clear, but I believe you meant the constraint should be for endDate to be >= Nov 10, together with startDate which is earlier than Nov 10. I believe all you need is to adjust the requirement to format startDate/endDate bounds. calculate bounds for startDate according to task duration and set constraint in regular format.

Pseudo code

getDateConstraints(taskRecord) {
    const 
        diff = taskRecord.endDate - "Nov 10 date",
        contraintStart = taskRecord.startDate - diff;

return { start : contraintStart, end: null };
}