resource_calendars

提供了一种定义工作日历的方法,可以将其链接到特定资源,如用户

object resource_calendars;

Available only in PRO Edition

Example

gantt.config.resource_property = "user"
gantt.config.resource_calendars = {
      1 : gantt.addCalendar({
          worktime: {
             days: [0, 1, 1, 1, 1, 1, 0]
          }
     })
};
 
// 将日历链接到特定任务
{"id":3, user:"1", "text":"Task #2", "start_date":"11-04-2013", 
    "duration":"4", "parent":"1", "progress": 0.6, "open": true}


Default value:

{}
Details

此功能仅包含在PRO版本中。

  • [resourceId: string | number] - (string | number | {[resourceId: string | number]: string | number | undefined } | undefined) - 定义资源日历的映射关系

在7.0版本之前,dhtmlxGantt使用了稍有不同的resource_calendars格式。

上面展示的为用户分配工作日历的更新方法更简单且更易用,但之前的resource_calendars配置格式仍然被支持:

// 定义一个工作日历
var johnCalendarId = gantt.addCalendar({
    worktime: {
        days: [0, 1, 1, 1, 1, 1, 0]
    }
}),
 
// 将日历链接到用户
gantt.config.resource_calendars = {
  "user":{
      1 : johnCalendarId
   }
};
See also
Change log
  • 在4.2版本中引入
  • 在7.0版本中更新配置格式
Back to top