I have a parent grid / child grid. and I can't seem to get the two working properly. Using the DetailInit event to set the data for the child grid, but the event is not even firing. The grids are server bound with a model. Here is the razor code. Thanks for the help.
Dan
Dan
@model IEnumerable<
EquipmentsSummary
>
<
div
class
=
"info-row"
>
@(Html.Kendo().Grid(Model)
.Name("EquipmentGrid")
.Columns(columns =>
{
columns.Bound(e => e.EquipName).Title("Item Name");
columns.Bound(e => e.SerialNo).Title("Serial #");
columns.Bound(e => e.AssetStatus).Title("Status");
columns.Bound(e => e.AssetStatusDate).Title("Date");
})
.HtmlAttributes(new { style = "height: 390px;" })
.Pageable(pageable => pageable
.PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
.ButtonCount(5))
.Sortable()
.Filterable()
.Scrollable()
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(false))
.ClientDetailTemplateId("template")
.Events(events => events.DetailInit("initDetail"))
)
<
script
id
=
"template"
type
=
"text/kendo-tmpl"
>
@(Html.Kendo().Grid<
EquipmentSettingsSummary
>()
.Name(string.Format("SettingGrid_#=ID#"))
.Columns(columns =>
{
columns.Bound(e => e.EffectiveDate).Title("Date");
columns.Bound(e => e.AssetStatus).Title("Status");
})
.HtmlAttributes(new { style = "height: 390px;" })
.Pageable(pageable => pageable
.PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
.ButtonCount(5))
.Sortable()
.Filterable()
.Scrollable()
.ToClientTemplate()
)
</
script
>
<
script
>
function initDetail(e) {
alert("ID is " + e.data.ID);
var grid = $("#SettingGrid_" + e.data.ID).data("kendoGrid");
grid.dataSource.data(e.data.SettingItems);
}
</
script
>
</
div
>