该控件用于呈现一组选项,同一时间只能选择其中一个。
要在 lightbox 中包含单选按钮控件,需要进行以下设置:
1) 在 lightbox 配置中添加一个 section:
var opts = [
{key: 1, label: "High"},
{key: 2, label: "Normal"},
{key: 3, label: "Low"}
];
gantt.config.lightbox.sections = [
{name: "description", height: 38, map_to: "text", type: "textarea", focus: true},
{name: "priority", height: 22, map_to: "priority", type: "radio", options: [opts]}, {name: "time", type: "duration", map_to: "auto"}
];
2) 为该 section 定义标签:
gantt.locale.labels.section_priority = "Priority";
以下是单选按钮控件常用的一些关键属性(完整列表请参见这里):
要为单选按钮控件指定选项,请使用 options 参数:
gantt.config.lightbox.sections = [
{name: "priority", map_to: "priority", type: "radio", options: [
{key: 1, label: "High"},
{key: 2, label: "Normal"},
{key: 3, label: "Low"},
]}
];
options 数组中的每一项都需要两个属性: