默认选择第一项,加请选择,取值问题
<input class="easyui-combobox" id="ddlWHS" name="ddlWHS" /> //combox默认选择第一个
$(function () {
$('#ddlWHS').combobox({
url: "../../HR/attType/list_attType.ashx?type=Bindddl",
valueField: 'WorkingHour_beginTime',
textField: 'WorkingHour_name',
editable: false,
onLoadSuccess: function (data) {
var data = $('#ddlWHS').combobox('getData');
if (data.length > ) {
$("#ddlWHS").combobox('select', data[].WorkingHour_beginTime);
}
}
});
}); // combox加请选择
$(function () {
$('#ddlWHS').combobox({
url: "../../HR/attType/list_attType.ashx?type=Bindddl",
valueField: 'WorkingHour_beginTime',
textField: 'WorkingHour_name',
editable: false,
//返回要显示的过滤数据
loadFilter: function (data) {
var o = [{ 'WorkingHour_beginTime': '', 'WorkingHour_name': '--请选择--'}];
return o.concat(data);
},
//当远程数据加载成功时触发
onLoadSuccess: function (data) {
var data = $('#ddlWHS').combobox('getData');
if (data.length > ) {
$("#ddlWHS").combobox('select', data[].WorkingHour_beginTime);
}
},
onSelect: function (record) {
//获取values
alert($("#ddlWHS").combobox("getValues"));
// 获取text
alert($("#ddlWHS").combobox("getText"));
} });
});