我在这个演示网站上有Kendo Hierarchical网格。我试图从子网格调用Change事件来做一些自定义操作。但是,改变事件永远不会发生。请指教。
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()
.Name("grid_#=EmployeeID#")
.Columns(columns =>
{columns.Bound(o => o.ShipName);})
.DataSource(dataSource => dataSource
...
)
.Events(events => events.Change("change"))
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
<script>
function change(e) {
alert('test');
}
</script>
答案 0 :(得分:0)
没关系。我找到了答案。我在子网格上缺少Selectable()。
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.OrderViewModel>()
.Name("grid_#=EmployeeID#")
.Columns(columns =>
{
columns.Bound(o => o.OrderID).Width(70);
columns.Bound(o => o.ShipCountry).Width(110);
columns.Bound(o => o.ShipAddress);
columns.Bound(o => o.ShipName).Width(200);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("HierarchyBinding_Orders", "Grid", new { employeeID = "#=EmployeeID#" }))
)
.Pageable()
.Sortable()
.Selectable()
.ToClientTemplate()
)