/**
* 初始化表配置Tab页
*/
function initDomainTableGrid(grid) {
var editRow = undefined;
var datagrid;
var types = this.buildRuleParamOption(null);
$('#'+grid).datagrid({
rownumbers: true,
nowrap: true, // 就会把数据显示在 一行里
striped: true, //隔行换色
collapsible: false,//是否可折叠的
fit: false,//自动大小
fitColumns: true,
pageSize: 8,
pageList: [7,14,21,28],
pageNumber: 1,
loadMsg: '正在加载数据...',
url: basePath + 'scriptAuditRule/getRuleParamsDetail',
queryParams: {
ruleId: $("#flid").val(),
functionCode: $("#functionCode").val()
},
loadFilter : pagerFilter,
remoteSort: false,
singleSelect: false,
//pagination: true,
rownumbers: true,
columns: [[
{ field: 'flid', hidden: 'true'},
{ field: 'param_id', hidden: 'true'},
{ field: 'paramCode',title: '参数名',width: 10,align: 'center' },
{ field: 'paramValue', title: '参数值', width: 10, align: 'center' ,
editor: {
type: 'combobox',
options: {
valueField: 'id',
textField: 'text',
data:types
}
}
},
{ field: 'paramName', title: '参数说明', width: 10, align: 'center' },
//{ field: 'paramRemark', title: '参数说明', width: 10,align: 'center' },
{ field: 'action',title:'操作',width:7,align:'center',
formatter:function(value,row,index){
return '<a href="#" onclick="editrow(this)">编辑 </a> ';
}
}
]],
onDblClickRow :function (rowIndex ,rowData){
combboxBindEvent(rowIndex);
}
});
}
//将datagrid 单元格中的combbox绑定 onchange事件,根据选择的检查元素,自动填充检查元素编码
function combboxBindEvent(rowIndex){
var ed = $('#Grid2').datagrid('getEditor', {index:rowIndex,field:'paramValue'});
$(ed.target).combobox({
onChange:function(current, old){
$('#Grid2').datagrid('updateRow',{
index: parseInt(rowIndex)+1,
row:{ paramValue : current }
});
}})
}
//初始化datagrid中的combbox
function buildRuleParamOption(paramCode){
var types = [{selected: true, text: "请选择元素编码", id: 0}];
if(paramCode=='null'){
return [];
}
$.post(basePath + "scriptAuditRule/buildRuleParamOption", {
"paramCode" : paramCode,
}, function(result) {
var jsonObj = eval(result.data);
for(var i=0;i<jsonObj.length;i++){
var obj = {};
obj.id =jsonObj[i].id ;
obj.text = jsonObj[i].text ;
types.push(obj);
}
}, 'json');
return types;
}
EasyUI DataGrid中单元格combbox绑定 onchange事件
猜你喜欢
转载自blog.csdn.net/weberhuangxingbo/article/details/84965131
今日推荐
周排行