$('#budgetIdstr').combobox({
valueField:'id',
textField:'orgName',
editable:false,
multiple:true,
separator:';',
// panelWidth:'auto',
formatter:function(row){
var opts;
if(row.selected==true){
opts = "<input style='width:15px;height:15px;vertical-align:middle;' type='checkbox' checked='checked' lass='combobox-checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
}else{
opts = "<input style='width:15px;height:15px;vertical-align:middle;' type='checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
}
return opts;
},
url:sname+'/BudgetinfoController/loadBudgetDetails',
loadFilter: function (rows) {
return rows;
},onSelect:function(rec) {
oCheckbox = document.getElementById(rec.id);
oCheckbox.checked=true;
},onUnselect:function(rec){
oCheckbox = document.getElementById(rec.id);
oCheckbox.checked=false;
},onShowPanel:function(){
$(this).combobox('panel').width("auto");
}
valueField:'id',
textField:'orgName',
editable:false,
multiple:true,
separator:';',
// panelWidth:'auto',
formatter:function(row){
var opts;
if(row.selected==true){
opts = "<input style='width:15px;height:15px;vertical-align:middle;' type='checkbox' checked='checked' lass='combobox-checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
}else{
opts = "<input style='width:15px;height:15px;vertical-align:middle;' type='checkbox' id='"+row.id+"' value='"+row.id+"'>"+row.orgName+"</input>";
}
return opts;
},
url:sname+'/BudgetinfoController/loadBudgetDetails',
loadFilter: function (rows) {
return rows;
},onSelect:function(rec) {
oCheckbox = document.getElementById(rec.id);
oCheckbox.checked=true;
},onUnselect:function(rec){
oCheckbox = document.getElementById(rec.id);
oCheckbox.checked=false;
},onShowPanel:function(){
$(this).combobox('panel').width("auto");
}
})
本文介绍了一个使用 jQuery 实现的 combobox 控件配置案例,该控件支持多选功能,并通过自定义 formatter 来实现复选框显示。文章详细展示了如何设置 combobox 的属性,包括 valueField、textField、editable 和 multiple 等。
2991

被折叠的 条评论
为什么被折叠?



