//①定义下拉框
//离线公司【个人或公司】 下拉框
var tmpComOrPer = {
type: 'combobox',
options: {
onSelect:function(data) {
ComOrPerChange(false);
},
editable:false,
panelHeight: 'auto',
valueField: 'Type',
textField: 'label',
data: [ {
label: '@BaseRes.OSP_CTL_087',
Type: '0'
}, {
label: '@BaseRes.OSP_CTL_088',
Type: '1'
}],
required: true
}
}
//②绑定下拉框
。。。。。
{ align: 'center', field: 'ComOrPer', title: '@BaseRes.OSP_CTL_127', width: 65, editor: tmpComOrPer}
。。。。。。
选择事件
onSelect:function(data) {
ComOrPerChange(false);
},
datagrid 动态绑定下拉框
function ComOrPerChange(bl) {
var row =comdg.thisdg.datagrid('getSelected');
var rowIndex = comdg.thisdg.datagrid('getRowIndex',row);//获取行号
var target = comdg.thisdg.datagrid('getEditor', {'index':rowIndex,'field':'ReportType'}).target;
var targetValue = target.combo("getValue");
target.combobox('clear'); //清除原来的数据
var targetComOrPer = comdg.thisdg.datagrid('getEditor', {'index':rowIndex,'field':'ComOrPer'}).target;
if (targetComOrPer.combo("getValue") == "1") {
target.combobox({data:[ {
label: '@BaseRes.OSP_CTL_100',
Type: '12'
}, {
label: '@BaseRes.OSP_CTL_101',
Type: '13'
}, {
label: '@BaseRes.OSP_CTL_102',
Type: '14'
}]});
} else {
target.combobox({data:[ {
label: '@BaseRes.OSP_CTL_089',
Type: '0'
}, {
label: '@BaseRes.OSP_CTL_090',
Type: '1'
}, {
label: '@BaseRes.OSP_CTL_091',
Type: '2'
}, {
label: '@BaseRes.OSP_CTL_092',
Type: '3'
}, {
label: '@BaseRes.OSP_CTL_093',
Type: '4'
}, {
label: '@BaseRes.OSP_CTL_094',
Type: '5'
}, {
label: '@BaseRes.OSP_CTL_095',
Type: '6'
}, {
label: '@BaseRes.OSP_CTL_096',
Type: '7'
}, {
label: '@BaseRes.OSP_CTL_097',
Type: '8'
}, {
label: '@BaseRes.OSP_CTL_098',
Type: '9'
},{
label: '@BaseRes.OSP_CTL_171',
Type: '10'
}, {
label: '@BaseRes.OSP_CTL_099',
Type: '11'
}@*, {
label: '@BaseRes.OSP_CTL_100',
Type: '12'
}, {
label: '@BaseRes.OSP_CTL_101',
Type: '13'
}, {
label: '@BaseRes.OSP_CTL_102',
Type: '14'
}*@]});
}
if(bl)
target.combobox("setValue", targetValue);
}