Support for v6.x of our Scheduling components


Post by friedj »

Dear Bryntum Team,

While reading studying your documentation, I would like to ask if it is possible to calculate the task duration based on task calendar?

My problem/example is: I have a project calendar, weekends are not working days, there is no other exception. I have a task which starts on Monday and ends on Friday. This task has a calendar where this Monday is non working day. So the task duration should be 4 days, right? In our case the task duration will be 5 days because the task specific calendar is not used in calculation.
Based on your doc. "Duration field always gets calculated based on the project calendar." Do you have any hints to my problem/question?

Thank you very much!


Post by pmiklashevich »

You took the sentence out of the context. Please read the following sentences together:

task's Duration field always gets calculated based on the project calendar. No matter what calendar is set to the task or to the resources. It's done to be able to visually compare tasks with different calendars assigned

It's done it case working hours per day are different in the project calendar and the task calendar. Only to make it possible to compare visually.

In your case there is another problem. We assume you load calculated data always. But since the calendar says Monday is a day-off, and you set the start date to Monday, the data is not valid. If there is a chance the data is not calculated, I would recommend to add a listener to the task store and on load call adjustToCalendar function. It will recalculate all your tasks.

Ext.first('ganttpanel').taskStore.on({
    load : function(store) {
        console.log('Recalculate tasks...');
        store.adjustToCalendar();
    },
    single : true // recalculate once
})

Technically it should be called when you load data from unconfirmed sources. Because once the data is calculated and you save it into a database, next time you load it, the data will be calculated.

Also keep in mind, if you set start and end date, the duration will be calculated. If you set start date and duration, the end date will be calculated.

Pavlo Miklashevych
Sr. Frontend Developer


Post Reply