Modify jquery Easyui combobox blur Filter
Copy Code code as follows:
Filter:function (Q,row) {
var opts=$ (this). ComboBox ("Options");
return Row[opts.textfield].indexof (q) ==0;//
return Row[opts.textfield].indexof (q) >-1;//match from scratch to any match
},formatter:function (Row) {
var opts=$ (this). ComboBox ("Options");
return Row[opts.textfield];
},loader:function (_7C9,_7CA,_7CB) {
var opts=$ (this). ComboBox ("Options");
if (!opts.url) {
return false;
}
Modify the Easyui ComboBox extension to select the first row by default
Easyui ComboBox Extension Default selection of the first line, the online have the crazy scholar of that was reprinted countless times of code, but that is only for easyui1.2.6, tried to 1.3.2 under the No, I wrote an extension method as follows:
Copy Code code as follows:
$.extend ($.fn.combobox.methods, {
Selectedindex:function (JQ, index) {
if (!index) {
index = 0;
}
$ (JQ). ComboBox ({
Onloadsuccess:function () {
var opt = $ (JQ). ComboBox (' Options ');
var data = $ (JQ). ComboBox (' GetData ');
for (var i = 0; i < data.length; i++) {
if (i = = index) {
$ (JQ). ComboBox (' SetValue ', eval (' data[index]. ' + Opt.valuefield));
Break
}
}
}
});
}
});
Invoke the method instance as follows:
Copy Code code as follows:
<script type= "Text/javascript" >
var currenturl = "Om_taking.aspx";
$ (function () {
$ (' #dept '). ComboBox ({
Url:currenturl + "Act=loaddept",
Valuefield: ' department_id ',
TextField: ' Department_name '
}). ComboBox (' SelectedIndex ', 0);
});
</script>