easyui-combox:控件的初始化;
可以在其中进行文字的筛选功能(过滤),
动态加载数据的方法。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<link rel="stylesheet" href="../EasyUI/themes/default/easyui.css">
<link rel="stylesheet" href="../EasyUI/themes/icon.css">
<script src="../EasyUI/jquery.min.js"></script>
<script src="../EasyUI/jquery.easyui.min.js"></script>
</head>
<body>
<input id="mycombox" name="mycombox">
<script>
$('#mycombox').combobox({
url:'combobox_data.json',
valueField:'id',
textField:'name',
onSelect: function (r) {
alert(r.id);
},
onLoadSuccess: function () {
$(this).combobox('setText', '--请选择--');
}
});
</script>
</body>
</html>
<!--json文件-->
[{
"id":1,
"name":"天蚕土豆"
},{
"id":2,
"name":"唐家三少"
},{
"id":3,
"name":"紫气东来",
"selected":true
},{
"id":4,
"name":"辰东"
},{
"id":5,
"name":"爱吃西红柿"
}]