码迷,mamicode.com
首页 > 其他好文 > 详细

easyui commbox嵌入一个checkbox的实现

时间:2016-11-23 12:44:25      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:multiple   val   pat   edit   pts   tip   prompt   cti   format   

function InitComBoBox(datagrid, combxid, formid, url, valueField, textField,_prompt) {
$(combxid).combobox({
url: Medicom.url + url,
method: ‘get‘,
valueField: valueField,
textField: textField,
panelHeight: ‘auto‘,
multiple: true,
width: 200,
editable: false,
prompt: _prompt,
formatter: function (row) {
var opts = $(this).combobox(‘options‘);
return ‘<label><input type="checkbox" class="combobox-checkbox"> ‘ + row[opts.textField] + ‘</label>‘
},
onShowPanel: function () {
var opts = $(this).combobox(‘options‘);
var target = this;
var values = $(target).combobox(‘getValues‘);
$.map(values, function (value) {
var el = opts.finder.getEl(target, value);
el.find(‘input.combobox-checkbox‘)._propAttr(‘checked‘, true);
})
},
onHidePanel: function () {
//提交给后台进行查询
},
onLoadSuccess: function () {
var opts = $(this).combobox(‘options‘);
var target = this;
var values = $(target).combobox(‘getValues‘);
$.map(values, function (value) {
var el = opts.finder.getEl(target, value);
el.find(‘input.combobox-checkbox‘)._propAttr(‘checked‘, true);
})
},
onSelect: function (row) {
var opts = $(this).combobox(‘options‘);
var el = opts.finder.getEl(this, row[opts.valueField]);
el.find(‘input.combobox-checkbox‘)._propAttr(‘checked‘, true);
},
onUnselect: function (row) {
var opts = $(this).combobox(‘options‘);
var el = opts.finder.getEl(this, row[opts.valueField]);
el.find(‘input.combobox-checkbox‘)._propAttr(‘checked‘, false);
}
});
}

easyui commbox嵌入一个checkbox的实现

标签:multiple   val   pat   edit   pts   tip   prompt   cti   format   

原文地址:http://www.cnblogs.com/huangf714/p/6092978.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!