我正在显示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>"
});
});
1 回答
你有没有从Kendo UI看过这个演示?
http://demos.telerik.com/kendo-ui/grid/detailtemplate
与您的方案类似,详细网格在detailInit函数中创建,详细网格数据使用e.data.EmployeeID过滤当前员工