easyui datagrid editor checkbox 单击事件

        Easyui datagrid treegrid中能够为行追加checkbox元素。比如:

    $('#tt').treegrid({
    url:'get_data.php',
    idField:'id',
    treeField:'name',
    columns:[[
    {title:'Task Name',field:'name',width:180},
    {field:'persons',title:'Persons',width:60,align:'right'},
    {field:'begin',title:'Begin Date',width:80},
    {field:'end',title:'End Date',width:80,editor:{type:'checkbox',options:{on:'1',off:'0'}}}
    ]]
    });

当中最后一列的checkbox:true即为复选框,建议不要使用

{field:'end',title:'End Date',width:80,formatter:function(val,row,index){
return '<input type="checkbox"/>' ;
}}
这样的方法导致复选框随行的选中而选中,不灵活。

那么怎样给这样的复选框追加单击事件或者传值呢?方法例如以下:

onLoadSuccess:function(row,data){
    var eds = $('#dr_col_auth').datagrid('getEditors',id);
    $(eds[0].target).bind('click',function(){
      //这里能够指定当前行的数据
    }
} 




posted @ 2017-07-09 12:02  llguanli  阅读(1358)  评论(0编辑  收藏  举报