easyui treegrid 添加复选框

$(function(){
    $('#test').treegrid({
        url:"data/treegrid_data.json",
        idField:'id',
        treeField:'name',
        animate:"true",
        rownumbers:"true",
        columns:[[
            {title:'Task Name',field:'name',formatter:function(value,rowData,rowIndex){
                return " " + rowData.name;
        },width:180},
            {field:'size',title:'Persons',width:60,align:'right'},
            {field:'date',title:'Begin Date',width:80}
        ]]
    });
    $("#consle").bind("click",consleclick)
});

function set_power_status(){
    var idList = "";
     $("input:checked").each(function(){
        var id = $(this).attr("id");
        if(id.indexOf("ceshi_")>-1)
            idList += id.replace("ceshi_",'')+',';
     })
    alert(idList);
}

function consleclick(){
    var node = $('#test').treegrid('expandAll',2);
}



一般会有个checkbox:true的列,删掉他就OK

如果是HTML结构就是<th data-options="field:'ck',checkbox:true"></th>
js结构就是:{field:'ck',title:'选择',checkbox:true},

你可能感兴趣的:(JavaScript,Ajax)