Jquery easyui ComboBox combines some HTML controls into one to achieve the expected results. The following describes the usage of the combox: (view the demo)
Wp-image-749 "Title =" jquery-easyui-ComboBox "alt =" "src =" http://www.ityizhan.com/wp-content/uploads/2010/05/jquery-easyui-combobox1.gif "width =" 385 "Height =" 178 "style =" display: inline ">
HTML code: First define a select
- <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>
After the necessary files are included in the jquery easyui framework user guide, you only need to insert the following code in $ (function:
- $ ('# CC'). ComboBox (options );
Options is some options of the combo box. For example, we can use remote data to generate a prompt box.
- $ ('# CC'). ComboBox ({
- URL: 'combobox _ data. json ',
- Valuefield: 'id ',
- Textfield: 'text'
- });
The following describes how to set the options:
Attribute
Default attribute name type description
Width |
Number |
Component width |
Auto |
Listwidth |
Number |
Width of the drop-down list |
Null |
Listheight |
Number |
Height of the drop-down list |
Null |
Valuefield |
String |
Bind the basic data value name to this combo box |
Value |
Textfield |
String |
The name of the field of the basic data is bound to this combo box. |
Text |
Editable |
Boolean |
Define whether text can be directly typed into a text field |
True |
URL |
String |
Remote URL for loading list data |
Null |
Event
Event name parameter description
Onloadsuccess |
None |
Triggered when remote data is loaded successfully. |
Onloaderror |
None |
Triggered when remote data loading fails. |
Onselect |
Record |
Triggered when a list item is selected |
Onchange |
Newvalue, oldvalue |
Triggered when the value of the text field changes |
Method
Method name parameter description
Select |
Value |
Select an item from the drop-down list |
Setvalue |
Param |
Set the specified value to the text field. The parameter can be a string or JavaScript Object. If it is an object, it must contain the valuefield and textfield attributes corresponding to each of the two attributes. |
Getvalue |
None |
Get Field Value |
Reload |
URL |
Request Remote list data. |
Demo
Http://jaychang.iteye.com/blog/850257