从带有预定义结构的 <select> 元素创建组合框(combobox)
<select id="searchDateNum" class="easyui-combobox" style="width: 120px;" editable="false">
<option value="0">所有</option>
<option value="1">正常</option>
<option value="2">三个月(黄色)</option>
<option value="3">半年(蓝色)</option>
<option value="4">半年以上(红色)</option>
</select>
使用 javascript 创建组合框(combobox)
<input id="cmbProduct_Name" />
$(‘#cmbProduct_Name‘).combobox({
url: "/Services/GetBaseInfo_Product",
valueField: ‘Product_Id‘,
textField: ‘Product_Name‘,
panelheight: "200"
});
var hyData = new Array();
$.post(
‘/Services/GetAllIndustry_Type‘,
function (data, textStatus) {
if (textStatus == "success") {
hyData.push({ "Industry_Type_Id": "", "Industry_Type_Name": "全部" });
$(data).each(function (i, val) {
hyData.push({ "Industry_Type_Id": val.Industry_Type_Id, "Industry_Type_Name": val.Industry_Type_Name });
});
$("#searchIndustry").combobox(‘loadData‘, hyData);
}
}, "json"
);
原文地址:https://www.cnblogs.com/rency/p/9875323.html