layui列表展示后禁止选中某一条记录

//方法级渲染
dataTable.render({
    elem: '#layui_table_data'
    , id: 'tableDataId'
    , url: serverPath + 'project/personelec/listLeftJoinEmpl'
    , toolbar: '#toolbar'
    , defaultToolbar: ['filter']
    , limits: [5, 10, 15, 20, 30, 60]
    , limit: getTableLimit2(1)
    , even: true //开启隔行背景
    , page: true
    , cellMinWidth: 100
    , cols: [[
        {type: 'checkbox', title: '选择'}
        , {field: 'name', title: '文档名称', width: 300}
        , {field: 'emplName', title: '文档所有人'}
        , {field: 'cardId', title: '身份证号', width: 200}
        , {field: 'typeName', title: '文档类型', width: 90}
        , {field: 'certificateNumber', title: '证书编号', width: 120}
        , {field: 'workStatusName', title: '状态'}
        , {field: 'startTime', title: '发证日期', width: 120}
        , {field: 'overTime', title: '到期时间', width: 120}
        , {field: 'chuangjianrxm', title: '创建人', width: 90}
        , {field: 'chuangjiansj', title: '创建时间', width: 170}

    ]]
    , done: function (res, curr, count) {
        $("[lay-filter='layTableAllChoose']").each(function () {
            $(this).prop('disabled', true).next().hide(); // 禁止全选
        });

        layui.each(res.data, function (i, item) {
            if (item.name == "4") {
                $(".layui-table tr[data-index=" + i + "] input[type='checkbox']").prop('disabled', true).prop('checked', true);
                //禁止选中样式
                $(".layui-table tr[data-index="+i+"] input[type='checkbox']").next().addClass('layui-btn-disabled');
                //设置背景颜色
                $(".layui-table tbody tr").eq(i).css("background-color","#cccccc").prop('disabled',true)
            }

        })
    }
});

 

Guess you like

Origin blog.csdn.net/qq_25231683/article/details/120577374
Recommended