Вопрос

I have the Kendo Hierarchical grid as the one on this demo site. I am trying to call the Change event from the child grid to do some custom action. However, the change event never fires. Please advice.

<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>
Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top