easyui datagrid checkbox单选时表头的checkbox不起作用,将其隐藏

来源:互联网 发布:windows平板手势 编辑:程序博客网 时间:2024/05/02 00:33

在easyui datagrid开发的过程中,某列是checkbox的,但是当单选时这个表头的框不起作用,将其隐藏。在网上找到的方法。

 function InitGrid() {
        $('#tg').treegrid({
            idField: 'id',
            treeField: 'descript',
            pagination: false,
            singleSelect: true,
            height: 360,
            title: "我的列表",
            columns: [[
            { field: 'ck', width: 50, checkbox: true },
   { field: 'id', title: '编号', width: 50, align: 'center' },
            { field: 'descript', title: '名称', width: 120 }
    ]],
            onLoadSuccess: function () {
                $("#tg").parent().find("div .datagrid-header-check").children("input[type=\"checkbox\"]").eq(0).attr("style", "display:none;");
            }
        });
    }

关键是在初始化时加上

onLoadSuccess: function () {
                $("#tg").parent().find("div .datagrid-header-check").children("input[type=\"checkbox\"]").eq(0).attr("style", "display:none;");
            }
这样就可以把表头的checkbox隐藏了。

1 0
原创粉丝点击