JQuery Easyui API combo box (ComboBox) Chinese document

Source: Internet
Author: User
Tags json
Extended from $.fn.combo.defaults. Rewrite the defaults with $.fn.combobox.defaults.

Depend on

Combo
Usage

The code is as follows Copy Code

<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>

<input id= "CC" name= "dept" value= "AA" >

$ (' #cc '). ComboBox ({

URL: ' Combobox_data.json ',

Valuefield: ' id ',

TextField: ' Text '

});

Example of JSON data format

[{

"id": 1,

"Text": "Text1"

},{

"id": 2,

"Text": "Text2"

},{

"id": 3,
"Text": "Text3",

' Selected ': True

},{

"id": 4,
"Text": "Text4"

},{

"id": 5,

"Text": "Text5"

}]

Its features extend from combo, and the following are the features that are added for ComboBox.

Name
Type
Description
Default value
Valuefield
String
The name of the underlying data on value that is bound to ComboBox.
Value
TextField
String
The name of the underlying data that is bound to ComboBox text.
Text
Mode
String
Defines how the list data is loaded when text changes. If the combo box is loaded from the server, it is set to ' remote '.
Local
Url
String
The URL from which the list data is loaded remotely.
Null
Method
String
The HTTP method used to retrieve the data.
Post
Data
Array
The list data that was loaded.
Null
Filter
function
Defines how data is filtered when ' mode ' is set to ' local '. This function has two parameters:
Q: Text entered by the user
Row: The line data in the list.
Returns true to allow the row to be displayed.
Formatter
function
Defines how rows are rendered. This function has one argument: row.

Event
Its events are extended from combo, and the following are the events that are incremented for ComboBox.

Name
Parameters
Description
Onloadsuccess
None
Triggered when remote data is loaded successfully.
Onloaderror
None
triggered when a remote data load fails.
Onselect
Record
Triggered when the user selects a list item.
Onunselect
Record
Triggered when a user cancels the selection of a list item.

Method
The method extends from combo, and the following methods are appended or overridden for ComboBox.

Name
Parameters
Description
Options
None
Returns the Options object.
GetData
None
Returns the loaded data.
LoadData
Data
Loads the local list data.
Reload
Url
Request remote list data.
Setvalues
Values
Sets the array to the value of the combo box.
SetValue
Value
Sets the value of the combo box.
Clear
None
Clears the value of the combo box.
Select
Value
Select the specified option.
Unselect
Value
Deselect the specified option.

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.