Html
<td style="width:30px;"><input type="text" style="width:100px;" id="ImsChargeRules" data-bind="comboboxReadOnly:true" class="z-txt easyui-combobox" data-options="multiple:true,panelHeight:'auto',panelWidth:150,required:true,valueField:'value',textField:'text'" /></td>
JS
$('#ImsChargeRules').combobox({
onBeforeLoad: function () {
$('#ImsChargeRules').combobox('clear');//清理下拉框
$('#ImsChargeRules').combobox('loadData', [{value:1,text:'张三'},{value:2,text:'李四'},{value:3,text:'王五'},{value:4,text:'其他'}]);//给下拉框加载数据源
$('#ImsChargeRules').combobox("setValues", "1,2".split(','));//给下拉框赋多个值
//$('#ImsChargeRules').combobox("setValue", 1);//给下拉框赋一个值
}
})
取值
var ImsChargeRules = $("#ImsChargeRules").combobox("getValues")//取多个值
//var ImsChargeRules = $("#ImsChargeRules").combobox("getValue")//取单个值
赋值回显
$('#ImsChargeRules').combobox("setValues", "1,2".split(','));//给下拉框赋多个值
//$('#ImsChargeRules').combobox("setValue", 1);//给下拉框赋一个值
效果图:
注意:combobox实现多选的属性是:multiple:true