Combo.json
[{
"id":-1,
"text": ",
" spell ":" "
},{
" id ": 1,
" text ":" Type 1 ",
" spell ":" Lx1 "
},{
"id": 2,
"text": "Type 2",
"spell": "LX2"
},{
"id": 3,
"text": "Type 3",
"spell": "Lx3 "
},{
" ID: 4,
"text": "Type 4",
"spell": "Lx4"
},{
"id": 5,
"text": "Type 5",
" Spell ":" Lx5 "
}]
The following is a code example
<form>
<input type= "text" id= "Combox1" >
</form>
/** * Easyui ComboBox Opens the search function, automatically loads the selected item handler function */function Oncomboboxhidepanel () {var el = $ (this);
El.combobox (' textbox '). focus ();
Check whether the input content is in the data var opts = El.combobox ("Options");
var data = El.combobox ("GetData");
var value = El.combobox ("GetValue");
If there are highlighted items, the var panel = el.combobox ("panel") is not further processed;
var items = Panel.find (". combobox-item-selected");
if (Items.length > 0) {var values = El.combobox ("GetValues");
El.combobox ("Setvalues", values);
Return
var allowinput = opts.allowinput;
if (allowinput) {var idx = data.length;
DATA[IDX] = [];
Data[idx][opts.textfield] = value;
Data[idx][opts.valuefield] = value;
El.combobox ("LoadData", data);
else {//Do not allow entry of any item, then empty El.combobox ("clear"); } $ ("#combox1"). ComboBox ({required:true, editable:true, missingmessage: ' Please select loading item ', Valuefield: "I D ", TextField:" Text ", Method:' Get ', url: ' Combo.json ', mode: ' Local ', Onhidepanel:oncomboboxhidepanel, Filter:function (q, Row) {
Defines how local data is filtered when ' mode ' is set to ' locals ', and the function has 2 parameters://q: The text entered by the user.
Row: List row data.
Allows rows to be displayed when True is returned.
Return row[$ (This). ComboBox (' Options '). Textfield].indexof (Q) >-1;
return row["spell"].indexof (q) >= 0; }
});
Above this article Easyui ComboBox open Search automatic completion of the example code is a small series to share all the content, hope to give you a reference, but also hope that we support the cloud-dwelling community.