以下にリストされている剣道グリッドがあります。各親行にチェックボックスがあります。ボタンをクリックすると、チェックボックスがオンになっているすべての親行の子グリッドを取得する必要があります。どうすればそれができますか?
ボタン移動
$('#btnMove').click(function ()
{
var parentgrid = $('#sampleGrid').data('kendoGrid');
var childGrid = $('#sampleGrid').closest(".k-grid").data("kendoGrid");
var Count = $('#sampleGrid').data("kendoGrid").dataSource.total();
alert(Count);
$(".chk").each(function ()
{
debugger;
var tr= $(this).closest("tr");
var itemParentRow = parentgrid.dataItem(tr);
//var childGrid = $(this).closest(".k-grid").data("kendoGrid");
});
});
親グリッド
$("#sampleGrid").kendoGrid({
dataSource: {
//type: "json",
type: "aspnetmvc-ajax",
transport: {
read: "Home/GetCostPageData",
dataType: "json"
//,type: "POST"
},
schema: {
model: {
fields: {
Program: {
type: "string",
//this field will not be editable (default value is true)
editable: false
},
Group: { type: "string" },
Sequence: { type: "string" }
}
},
total: "Total",
data: "CostPages"
},
pageSize: 25,
serverPaging: true,
serverFiltering: true,
serverSorting: true,
serverGrouping: true,
requestStart: function (e) {
Logger.logMessage("request started");
},
requestEnd: function (e) {
Logger.logMessage("request ended");
},
change: function (e) {
var data = this.data();
},
error: function (e) {
alert("error");
}
},
detailInit: detailInit,
dataBound: function ()
{
//this.expandRow(this.tbody.find("tr.k-master-row").first());
},
height: 500,
filterable: true,
sortable: true,
pageable: true,
groupable: true,
columns: [
{
field: "Recon",
title: "Select",
"template": "<input class='chk' type=\"checkbox\" />",
width: 25
},
{
field: "Program",
title: "Program",
width: 100
},
{
field: "Group",
title: "Group",
width: 100
},
{
field: "Sequence",
title: "Sequence",
width: 100
},
{
field: "Description",
title: "Description",
width: 100
}
],
editable:
{
mode: "inline"
//inline/incell/popup
},
toolbar: ["create"],
edit: function (e) {
if (!e.model.isNew()) {
// Disable the editor of the "id" column when editing data items
var numeric = e.container.find("input[name=id]").data("kendoNumericTextBox");
numeric.enable(false);
}
},
cancel: function (e) {
e.preventDefault();
}
});
子グリッド
function detailInit(e) {
var myPerson = {};;
myPerson.FirstName = "A";
myPerson.LastName = "B";
var id = e.data.uid;
$("<div id =" + id + "/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
type: "aspnetmvc-ajax",
transport: {
dataType: "json",
//type: "POST",
read: {
url: "Home/GetItemsData",
data: function () {
return myPerson;
}
}
},
schema: {
model: {
fields: {
Program: {
ItemID: "number",
},
ItemDescription: { type: "string" }
}
},
total: "Total",
data: "Items"
},
serverPaging: true,
serverSorting: true,
serverFiltering: true,
pageSize: 5
},
scrollable: false,
sortable: true,
pageable: true,
columns: [
{ field: "ItemID", title: "Item Id", width: "70px" },
{ field: "ItemDescription", title: "Item Description", width: "110px" }
]
});
}