Jquery 如何在构建ChildGrid时选中绑定到其上的复选框以获取ChildGrid的行详细信息

Jquery 如何在构建ChildGrid时选中绑定到其上的复选框以获取ChildGrid的行详细信息,jquery,kendo-grid,Jquery,Kendo Grid,我正在MasterGrid中构建一个ChildGrid。在子网格中,我向每一行添加一个复选框模板。选中childgrid复选框时,它将调用一个函数。在选中childgrid复选框时,任何人都可以帮助我获取childgrid行的详细信息 提前谢谢 $("#grid").kendoGrid({ dataSource: { data: jdata, schema: gridschema, pageSize: 10

我正在MasterGrid中构建一个ChildGrid。在子网格中,我向每一行添加一个复选框模板。选中childgrid复选框时,它将调用一个函数。在选中childgrid复选框时,任何人都可以帮助我获取childgrid行的详细信息

提前谢谢

$("#grid").kendoGrid({

   dataSource: {
            data: jdata,
            schema: gridschema,
            pageSize: 10
    },
    pageable:   true,
    detailInit: GetEvents,
    selectable: 'multiple',
    columns: column,
    editable: { mode: "popup" },
    scrollable: true,
    width:1250
});

function GetEvents(e)
{  

var schema=  { 
       model:  {
        id: "Type",
        fields: {
            Type: { editable: false, nullable: true },
            Date: { type: "date" }        
        }
    }
};
try
{
    dataSource = new kendo.data.DataSource({
        transport: {
            read:function (options) {
                jQuery.support.cors = true;
                 $.ajax(
                 {
                     url: serviceURL ,
                     type: "POST",
                     dataType: "json",
                     data:jsonString,
                     contentType: "application/json; charset=utf-8",
                     success: function (data) {
                         var res=   jQuery.parseJSON(data.d)  ;                            
                         options.success(res.events);
                     } ,
                     error: function (d,status,error) { alert(d,status,error); }
                 });
            }
        },
        batch: true,
        schema: schema,
        filter: { field: "Type", operator: "eq", value: e.data.Type },
        pageSize: 5

    });
    GetEventsByBreachchildGrid=   $('<div/>').appendTo(e.detailCell).kendoGrid({
        dataSource:dataSource   ,
        pageable: {
            refresh: true,
            pageSizes: true
        },
        selectable: 'multiple',
        columns:  [
            { field: "Date", title: " Date & Time",template: '#=                     kendo.toString(Date,"dd/MM/yyyy h:mm:ss tt") #', width: "350px" },
            { field: "Type", title:"Event Type"},
            {title:"Action", template: '<input class="events"  id="${id}" type="checkbox" onclick="Test()"/>',  width: 70 }],
        scrollable: false,
        sortable: true
    }).data("kendoGrid");
$(“#网格”).kendoGrid({
数据源:{
数据:jdata,
schema:gridschema,
页面大小:10
},
pageable:对,
detailInit:GetEvents,
可选:“多个”,
列:列,
可编辑:{模式:“弹出”},
可滚动:对,
宽度:1250
});
函数GetEvents(e)
{  
var schema={
型号:{
id:“类型”,
字段:{
类型:{editable:false,nullable:true},
日期:{type:“Date”}
}
}
};
尝试
{
dataSource=新建kendo.data.dataSource({
运输:{
阅读:功能(选项){
jQuery.support.cors=true;
$.ajax(
{
url:serviceURL,
类型:“POST”,
数据类型:“json”,
资料来源:jsonString,
contentType:“应用程序/json;字符集=utf-8”,
成功:功能(数据){
var res=jQuery.parseJSON(data.d);
选项。成功(res.events);
} ,
错误:函数(d,状态,错误){alert(d,状态,错误);}
});
}
},
批次:对,
schema:schema,
筛选器:{字段:“类型”,运算符:“eq”,值:e.data.Type},
页面大小:5
});
GetEventsByReachChildGrid=$('').appendTo(e.detailCell).kendoGrid({
数据源:数据源,
可分页:{
刷新:是的,
页面大小:正确
},
可选:“多个”,
栏目:[
{字段:“日期”,标题:“日期和时间”,模板:'#=kendo.toString(日期,“dd/MM/yyyy h:MM:ss tt”)#',宽度:“350px”},
{字段:“类型”,标题:“事件类型”},
{标题:“操作”,模板:“”,宽度:70}],
可滚动:false,
可排序:正确
}).数据(“kendoGrid”);

首先,您需要更改使用
this
参数调用
Test
函数的模板。类似如下:

template: '<input class="events" id="${id}" type="checkbox" onclick="Test(this)"/>',

非常感谢你的帮助
function Test(me) {
    // me is the input
    console.log("Test", me);
    // row is the tr containing all the record.
    var row = $(me).closest("tr");
    console.log("row", row);
    // Lets find the grid, since we do not have an id we find the closest grid (class k-grid)
    var grid = $(row).closest(".k-grid").data("kendoGrid");
    console.log("grid", grid);
    // And finally get the item data
    var item = grid.dataItem(row);
    console.log("item", item);
}