这是一个简单的双状态复选框控件,用于切换某个选项或多个值的开启和关闭。
它在以下场景中非常有用:
Related sample: Checkbox control
gantt.config.lightbox.project_sections = [
{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
{name: "split", type:"checkbox", map_to: "render", options:[ {key:"split", label:"Split Task"} ]}, {name: "time", type: "duration", readonly: true, map_to: "auto"}
];
要在 lightbox 中包含 checkbox 控件,需要:
1) 在 lightbox 配置中添加一个 section:
var opts = [
{key:"split", label:"Split Task"}
];
gantt.config.lightbox.sections = [
{name: "description", height: 70, map_to: "text", type: "textarea", focus: true},
{name: "split", type:"checkbox", map_to: "render", options:opts}, {name: "time", type: "duration", readonly: true, map_to: "auto"}
];
2) 为该 section 定义一个标签:
gantt.locale.labels.section_split = "Display";
以下是 checkbox 控件常用的一些关键属性(完整列表请参见此处):
要为 checkbox 控件设置值,通常使用 options 参数:
gantt.config.lightbox.sections = [
{name: "split", type:"checkbox", map_to: "render", options:[
{key:"split", label:"Split Task"}
]}
];
options 数组中的每一项都必须包含以下两个属性: