constraint_types
信息
此功能仅在 PRO 版本中可用。
Description
包含所有可用的约束类型
constraint_types: { ASAP?: string; ALAP?: string; SNET?: string; SNLT?: string; FNET?: string; FNLT?: string; MSO?: string; MFO?: string; }
Related samples
Details
对象定义:
- ASAP - (string) - 尽快
- ALAP - (string) - 尽可能晚
- SNET - (string) - 开始不得早于
- SNLT - (string) - 开始不得晚于
- FNET - (string) - 结束不得早于
- FNLT - (string) - 结束不得晚于
- MSO - (string) - 必须在指定日期开始
- MFO - (string) - 必须在指定日期完成
gantt.config.constraint_types = {
// As Soon As Possible
ASAP: "asap",
// As Late As Possible
ALAP: "alap",
// Start No Earlier Than
SNET: "snet",
// Start No Later Than
SNLT: "snlt",
// Finish No Earlier Than
FNET: "fnet",
// Finish No Later Than
FNLT: "fnlt",
// Must Start On
MSO: "mso",
// Must Finish On
MFO: "mfo"
};
它的添加是为了避免在代码中对约束值进行硬编码:
gantt.addTaskLayer(function draw_deadline(task) {
var constraintType = gantt.getConstraintType(task);
var types = gantt.config.constraint_types;
if (constraintType != types.ASAP &&
constraintType != types.ALAP && task.constraint_date) {
// 显示相关内容
}
return false;
});
Related API
Related Guides
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.