$('#dg').datagrid({
url:'datagrid_data.json',
columns:[[
{field:'code',checkbox:true,title:'Code',width:100},
{field:'name',title:'Name',width:100},
{field:'price',title:'Price',width:100,align:'right'}
]]
}); 如何让符合条件的选项不可选中jQueryUIdatagridCheckBoxJavaScript
//如果该行不能被选中,则调用取消选中方法
if(CanNotCheck(rowData)){
setTimeout(function(){
$('#dg').datagrid('unselectRow',rowIndex);
},0);
}
},function CanNotCheck(r){
if(r.xxx==???)
return true;
return false;
}
结题吧
$('#dg').datagrid({
url:'datagrid_data.json',
columns:[[
{field:'code',checkbox:true,title:'Code',width:100},
{field:'name',title:'Name',width:100},
{field:'price',title:'Price',width:100,align:'right'}
]],
onSelect:function(rowIndex, rowData){
//如果该行不能被选中,则调用取消选中方法
if(CanNotCheck(rowData)){
setTimeout(function(){
$('#dg').datagrid('unselectRow',rowIndex);
},0);
}
}
});
function CanNotCheck(r){
if(r.xxx==???)
return true;
return false;
}