Jquery easyui combo box (ComboBox)

Source: Internet
Author: User

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

  1. <Select id = "cc" name = "Dept" style = "width: 200px;">
  2. <Option value = "AA"> aitem1 </option>
  3. <Option> bitem2 </option>
  4. <Option> bitem3 </option>
  5. <Option> ditem4 </option>
  6. <Option> eitem5 </option>
  7. </SELECT>

After the necessary files are included in the jquery easyui framework user guide, you only need to insert the following code in $ (function:

  1. $ ('# CC'). ComboBox (options );

Options is some options of the combo box. For example, we can use remote data to generate a prompt box.

  1. $ ('# CC'). ComboBox ({
  2. URL: 'combobox _ data. json ',
  3. Valuefield: 'id ',
  4. Textfield: 'text'
  5. });

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.