我所拥有的是从服务传递的以下 DTO
class ServiceDto
{
public string Name { get; set; }
public string Complete { get; set; }
public string Incomplete{ get; set; }
public List<ServiceDto> Detail{ get; set; }
}
本质上,我有一个团队,其中有用户,服务返回的数据看起来像这样
Team 1 3 5
John Doe 1 3
Mike Low 2 2
Team 2 3 3
Bob Smith 1 2
Alice Smith 2 1
我已经像这样实现了等式的第一部分:
$(document).ready(function () {
var element = $("#grid").kendoGrid({
dataSource: {
type: "json",
transport: {
read: "../home/service"
}
}
detailInit: detailInit,
dataBound: function () {
this.expandRow(this.tbody.find("tr.k-master-row").first());
},
columns: [
{ field: "Name", title: "Team Name"},
{ field: "Complete"},
{ field: "Incomplete"}
]
});
});
但我不确定如何将每个结果的详细信息传递给detailInit
目前看起来像这样的 init 函数:
function detailInit(e) {
$("<div/>").appendTo(e.detailCell).kendoGrid({
dataSource: {
type: "json",
transport: {
read: ???
},
},
columns: [
{ field: "Name", title: "User Name" },
{ field: "Complete", title: "Completed task" },
{ field: "Incomplete", title: "Incomplete tasks" }
]
});
}
我需要做什么才能从父级传递数据?