Usage
Markup
<select id="cc" name="dept" style="width:200px;"> <option value="aa">aitem1</option> <option>bitem2</option> <option>bitem3</option> <option>ditem4</option> <option>eitem5</option></select>
jQuery
$('#cc').combobox(options);
To create from remote data: 要创建远程数据:
$('#cc').combobox({ url:'combobox_data.json', valueField:'id', textField:'text'});
Dependencies
none
Options
Override defaults with $.fn.combobox.defaults.
Properties
Name | Type | Description | Default |
width |
number |
The width of the component. 组件的宽度。 |
auto |
listWidth |
number |
The width of the drop down list. 该下拉列表宽度。 |
null |
listHeight |
number |
The height of the drop down list. 该下拉列表的高度。 |
null |
valueField |
string |
The underlying data value name to bind to this ComboBox. 基础数据值名称绑定到这个组合框。 |
value |
textField |
string |
The underlying data field name to bind to this ComboBox. 基础数据的字段的名称绑定到这个组合框。 |
text |
editable |
boolean |
Defines if use can type text directly into the field. 如果使用可以直接定义到域中键入文本。 |
true |
url |
string |
A URL to load list data from remote. 从一个远程的URL加载列表数据。 |
null |
|
Events
Name | Parameters | Description |
onLoadSuccess |
none |
Fires when remote data is loaded successfully. 触发时,远程数据加载成功。 |
onLoadError |
none |
Fires when remote data load error. 触发时,远程数据加载错误。 |
onSelect |
record |
Fires when user select a list item. 触发,当用户选择一个列表项。 |
onChange |
newValue, oldValue |
Fires when the field value is changed. 触发时,字段的值被改变了。 |
|
Methods
Name | Parameter | Description |
select |
value |
Select an item in the dropdown list. 选择一个项目在下拉列表中。 |
setValue |
param |
Set the specified value into the field. The ‘param’ parameter can be a value string or a javascript object that contains two properties corresponding to valueField and textField property. 设置为指定值的字段。 The ‘param’ parameter can be a value string or a javascript object that contains two properties corresponding to valueField and textField property.在’帕拉姆库马拉’参数值可以是一个字符串或一个JavaScript对象,它包含两个属性对应valueField和TextField属性。 |
getValue |
none |
Get the field value. 获取字段值。 |
reload |
url |
Request the remote list data. 要求远程列表数据。 |
|
原文页面:http://jquery-easyui.wikidot.com/document:combobox