$('#grid').datagrid({
columns:[[
{field:'CODE_NM',title:'名称',align:'center',width:'40%'},
{field:'a',title:'选项A',width:'15%',align:'center',
formatter: function (value, rowData, rowIndex) {
if(value=="1"){
return '<input type="checkbox" id="a_'+rowIndex+'" />';
}else if(value="0"){
return '<input type="checkbox" id="a_'+rowIndex+'" checked = "checked"/>';
}
}},
{field:'b',title:'选项B',width:'15%',align:'center',
formatter: function (value, rowData, rowIndex) {
if(value=="1"){
return '<input type="checkbox" id="b_'+rowIndex+'" />';
}else if(value=="0"){
return '<input type="checkbox" id="b_'+rowIndex+'" checked="checked"/>';
}
}}
]],
width:'100%',
hight:'100%',
rownumbers:true,
title:'列表信息',
url:"getDetail",
onClickRow:function(index,row){
$('#grid').datagrid('clearSelections');
if($('#a_'+index).get(0).checked){
row.a = "0";
}else{
row.a = "1";
}
if($('#b_'+index).get(0).checked){
row.b = "0";
}else{
row.b = "1";
}
},
dataType:"json",
type:'post',
onLoadSuccess:function(data){
}
});