日期:2014-05-16  浏览次数:20415 次

jquery easy ui datagrid checkbox设置符合条件的不可选,跪求大神帮忙

$('#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'}  
    ]]  
}); 

如何让符合条件的选项不可选中
jQuery UI datagrid CheckBox JavaScript

------解决方案--------------------
        onSelect:function(rowIndex, rowData){
            //如果该行不能被选中,则调用取消选中方法
            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;
}