Combo(组合框)
本节介绍由 DHTMLX Combo 组 件 提供的组合框。
var holders = [
{ key: 1, label: 'James' },
{ key: 2, label: 'Alex' },
{ key: 3, label: 'Antony' },
{ key: 4, label: 'Andrew' }
];
scheduler.locale.labels.section_holder = "Holder";
scheduler.config.lightbox.sections = [
{ name:"description", height:50, map_to:"text", type:"textarea", focus:true },
{ name:"holders", options:holders, map_to:"holders", type:"combo",
image_path:"../common/dhtmlxCombo/imgs/", height:30, filtering:true},
{ name:"time", height:72, type:"time", map_to:"auto"}
];
初始化
要在 lightbox 中包含 Combo 控件,请按照以下步骤操作:
- 引入 dhtmlxCombo 文件:
<script src="../codebase/dhtmlxscheduler.js" ...></script>
<link rel="stylesheet" href="../codebase/dhtmlxscheduler.css" ...>
<link rel="stylesheet" href="common/dhtmlxCombo/dhtmlxcombo.css" ..>
<script src="common/dhtmlxCombo/dhtmlxcombo.js" ...></script>
- 在页面上启用 editors 扩展:
scheduler.plugins({
editors: true
});
- 在 lightbox 配置中添加相应的 section:
scheduler.config.lightbox.sections = [
{ name:"description", ... },
{ name:"holders", options:holders, map_to:"holders", type:"combo",
image_path:"../common/dhtmlxCombo/imgs/", height:30, filtering:true},
{ name:"time", ...}
];
- 为该 section 设置标签:
scheduler.locale.labels.section_holders = "Holder";
属性
以下是 'combo' 控件常用的重要属性(完整列表请参见 此处):
| name | (string) section 的名称 |
| height | (number) section 的高度 |
| map_to | (string) section 映射的数据属性名称 |
| type | (textarea,time,select,template,multiselect,radio,checkbox,combo) section 控件的类型 |
| options | (对象数组) 定义控件的选项(适用于 'select'、'multiselect'、'radio'、'combo' 控件)。 每个数组对象表示一个选项,包括以下属性:
|
| image_path | (string) dhtmlxCombo 图片的路径 |
| filtering | (boolean, string) 启用自动过滤支持(输入时过滤选项)。可选 该参数可取以下值之一:
|
| script_path | (string) 提供 combo 选项的服务端脚本路径。可选 |
| cache | (boolean) 启用或禁用脚本响应的缓存(建议启用)。可选 |