easyui datagrid 让某行复选框置灰不能选

来源:互联网 发布:fins超出数组 编辑:程序博客网 时间:2024/05/22 16:32
$('#dg').datagrid({
    url:"url",
    method:'post',
    singleSelect: false,
    collapsible: true,
    autoRowHeight: 35,
    fitColumns: true,
    pagination: true,
    rownumbers: true,
    rowStyler:function(index,row){
        if(row.isFinanceExamine==1){
            return 'background-color:#6293BB;color:#fff;font-weight:bold;';
        }
    },
    onLoadSuccess: function(data){//加载完毕后获取所有的checkbox遍历
        if (data.rows.length > 0) {
            //循环判断操作为新增的不能选择
            for (var i = 0; i < data.rows.length; i++) {
                //根据isFinanceExamine让某些行不可选
                if (data.rows[i].isFinanceExamine == 1) {
                    $("input[type='checkbox']")[i + 1].disabled = true;
                }
            }
        }
    },
    onClickRow: function(rowIndex, rowData){
        //加载完毕后获取所有的checkbox遍历
        $("input[type='checkbox']").each(function(index, el){
            //如果当前的复选框不可选,则不让其选中
            if (el.disabled == true) {
                $('#dg').datagrid('unselectRow', index - 1);
            }
        })
    }
});
0 0
原创粉丝点击