【问题标题】:Create multiple nested Child grids in Kendo UI Grid using ASP.NET MVC使用 ASP.NET MVC 在 Kendo UI Grid 中创建多个嵌套的子网格
【发布时间】:2014-05-27 06:27:59
【问题描述】:

我们可以使用 ASP.NET MVC 在 Kendo UI Grid 中实现多个子嵌套网格吗?​​我可以实现 1 或 2 个子网格,但如何在一个父 kendo Grid 中实现 5-6 个子网格

@(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.EmployeeViewModel>()
        .Name("grid")
        .Columns(columns =>
        {
            columns.Bound(e => e.FirstName).Width(110);
            columns.Bound(e => e.LastName).Width(110);
            columns.Bound(e => e.Country).Width(110);
            columns.Bound(e => e.City).Width(110);
            columns.Bound(e => e.Title);

        })               
        .Sortable()
        .Pageable()
        .Scrollable()
        .ClientDetailTemplateId("template")
        .HtmlAttributes(new { style = "height:430px;" })
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(6)
            .Read(read => read.Action("HierarchyBinding_Employees", "Grid"))            
        )        
        .Events(events => events.DataBound("dataBound"))
)

<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()
            .ToClientTemplate()
    )
</script>
<script>
    function dataBound() {
        this.expandRow(this.tbody.find("tr.k-master-row").first());
    }
</script>

样本或演示链接将不胜感激。在此先感谢

【问题讨论】:

标签: asp.net-mvc kendo-ui kendo-grid kendo-asp.net-mvc


【解决方案1】:

基本上你应该遵循同样的方法。您唯一需要担心的是每个 Grid 都应该有唯一的名称。

查看以下demo,层次结构共有3级。

【讨论】:

  • 谢谢。显示 3 级层次结构。这可以以一种程序化的方式完成吗?根据数据网格应该自动创建嵌套网格吗?​​
  • 不不可能,你应该知道Children的结构,不能动态解析
猜你喜欢
  • 1970-01-01
  • 2013-09-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2014-07-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多