1、将代码添加到common.js
//多选下拉框加上全选 只支持valueField = 'value', textField = 'label',
window.commboboxAddSelectedAllValue = function(_data){
if(!_data || _data.toString().length < 1){
return _data;
}
var o = [{'value' : '' , 'label' : '--全部--'}];
return o.concat(_data);
}
//多选下拉框选择的数据样式
window.commboboxFornatter = function(_this, _row){
var opts = $(_this).combobox('options');
return '<input type="checkbox" class="combobox-checkbox" style="width:15px;">' + _row[opts.textField];
}
//获取下拉框中所有的值
window.getcomboboxValues = function(_this){
var data = $(_this).combobox('getData');
var datas = new Array(data.length);
for(var a in data) {
datas[a] = data[a].value;
}
return datas;
}
//根据状态选中/取消选中来获取该调用什么方法
window.getCommboboxActionByStatus = function(_status){
if(_status == true){
return "select";
}
return "unselect";
}
//根据传入的值,控制下拉框的checkbox是否选中
window.setComboboxCheckedStatus = function(_this, _value, _status, _opts){
var el = _opts.finder.getEl(_this, $.trim(_value));
el.find('input.combobox-checkbox')._propAttr('checked', _status);
try {// 如果combobox中没有值会报错
$(_this).combobox(getCommboboxActionByStatus(_status),$.trim(_value));
} catch (_error) {
//alert("|"+_valueArr[i]+"|"+_error)
}
}
//设置多选下拉框中数据是否选中的状态
window.setComboboxAllCheckboxStatus = function(_this, _status, _values){
//获取下拉中的数据
var children = $(_this).combobox("panel").children();
$.each(children, function(index, obj){
obj.firstChild.checked = _status;
});
$(_this).combobox('setValues',_values);
}