Resources store and inherit calendar

Hi

I just want to confirme that if I have resource store set up like this:

gantt.config.resource_store = “resources”;
gantt.config.resource_property = “resources”;

then if I set resources property on task, even if its a empty array, then that task will not inherit its parent calendar anymore, is this the right behaviour?

Hello Qianhao,
A child task can inherit the calendar of its parent project only if you enable the inherit_calendar config:
https://docs.dhtmlx.com/gantt/api__gantt_inherit_calendar_config.html

Then the child task can inherit the calendar of its parent project if the task doesn’t have its own calendar, and the parent project has its calendar.

It works similarly for resource calendars. A child task will inherit the calendar of its parent project only if no resource is assigned to the child task and at least one resource with the calendar is assigned to the parent project.

If you set an empty array as a resource value, this is not a valid resource, so, it works as if no resource is assigned to a task.

You can experiment with that in the following snippet:
https://snippet.dhtmlx.com/yz7wl48e

Hi thanks for this.

currently I am having problem where I have resources, resource_calendars and inherit_calendar, set up.

An then I have task 1 ,2 ,3 and child task of 2 → 2.1 and 2.2

Than set fulltime calender for task 2

and then set resource assignment for task 1

then the problem appears, i notices for those task dose not have resource assignment such as task 2.1 and 2.2, on these task, resources property is still set to empty array [], then this is causing problme where when I am trying to get task calendar for task 2.2, it suppose to get the calendar ‘fulltime’, but because of resources property is set on 2.2, that breaks it and make gettaskcalendar to return global

Dose this seems a right behaviour?

seems set this to true fixed that problem, not sure if its a bug

dynamic_resource_calendars = true;

Hello Qianhao,
Thank you for letting us know about the issue. This looks like a bug. When the resource property has a falsy value, the task can inherit the project calendar. But when it is an empty array, Gantt returns the global calendar. It happens because because of the combination of several conditions. When the resource_calendars config is enabled, Gantt tries to obtain the calendar from the resource property. And as it is an array, Gantt checks the dynamic_resource_calendars config. When that config is disabled, Gantt calls the getResourceCalendar method for the first item of the array. If the array is empty, Gantt returns the global calendar.
The dev team will fix the bug in the future, but I cannot give you any ETA.

However, it makes sense turning on the dynamic_resource_calendars config as otherwise, if you assign multiple resources to a task, it will obtain the calendar only from the first assigned resource.