0

我在这个演示站点上使用了 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>
4

1 回答 1

0

Never mind. I found the answer. I was missing Selectable() on the child grid.

<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()
)

于 2014-03-20T21:14:37.180 回答