我正在显示Grid并使用detailTemplate来expandRow。但是当展开行时,我想传递行ID并获取数据源并显示另一个网格。
我认为detailTemplate在这种情况下不起作用。我怎么能这样做?
这是我的代码
$(document).ready(function () {
var dataSource = new kendo.data.DataSource({
pageSize: 20,
data: [
{ id: "1", name: "Andrew", age: "30" },
{ id: "2", name: "Robert", age: "29" },
{ id: "3", name: "Frank", age: "35" }
],
autoSync: true,
schema: {
model: {
id: "id",
fields: {
id: { editable: false, nullable: true, type: "number" },
name: { editable: false },
age: {
validation: { min: 0, required: true },
editable: true,
nullable: true,
type: "number"
}
}
}
}
});
$("#grid").kendoGrid({
dataSource: dataSource,
pageable: true,
height: 550,
editable: "inline",
columns: [
{ field: "name",title: "Name" },
{ field: "age", title: "Age", width: "180px"},
{ command: ["edit"] }
],
detailTemplate: "<div>Name: #: name #</div><div>Age: #: age #</div>"
});
});
答案 0 :(得分:0)
您是否从Kendo UI检查了此演示?
http://demos.telerik.com/kendo-ui/grid/detailtemplate
与您的方案类似,详细网格在 detailInit 功能中创建,详细网格数据使用 e.data.EmployeeID
过滤当前员工