跳到主要内容

resource_calendars

信息

此功能仅在 PRO 版本中可用。

Description

定义一组可以分配给特定资源(如用户)的工作日历

resource_calendars: { [resourceId: string | number]: string | number | { [resourceId: string | number]: string | number | undefined } | undefined }

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

  • [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
}
};
Need help?
Got a question about the documentation? Reach out to our technical support team for help and guidance. For custom component solutions, visit the Services page.