@(Html.Kendo().Grid<
Zeus.Models.AnswerGroup
>(Model.Groups)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(p => p.Id);
columns.Bound(p => p.QuestionGroupName);
})
.Sortable()
.Pageable()
.ClientDetailTemplateId("detailTemplate")
.Events(e => e.DetailInit("onDetailInit"))
.Events(e => e.DataBound("dataBound"))
)
<
script
id
=
"detailTemplate"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
Zeus.Models.AnswerDetail
>()
.Name("answersGrid_#=Id#")
.AutoBind(false)
.DataSource(ds => ds
.Ajax()
.ServerOperation(false)).ToClientTemplate()
)
</
script
>
<
script
type
=
"text/javascript"
language
=
"javascript"
>
function dataBound(e) {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
function onDetailInit(e) {
var grid = $("#answersGrid_" + e.data.Id).data("kendoGrid");
grid.dataSource.data(e.Groups.Answers);
}
</
script
>