我有父网格和子网格,我正在使用kendo UI 网格(层次网格格式)将子网格数据绑定到父网格中的相应行,因为我只能显示第一行的子网格而无法显示另一行的相同细节...
这是我对该网格的看法...
@model IEnumerable<KendoSampleMVCApp.Models.EmployeesDetailsModel>
@{
ViewBag.Title = "Index";
}
<h2>Index</h2>
@using (Html.BeginForm())
{
@(Html.Kendo().Grid<KendoSampleMVCApp.Models.EmployeesDetailsModel>()
.Name("ParentGrids")
.Columns(columns =>
{
columns.Bound(e => e.EmployeeID).Width(100);
columns.Bound(e => e.EmployeeFirstName).Width(100);
columns.Bound(e => e.EmployeeSecondName).Width(100);
columns.Bound(e => e.EmployeeCity).Width(100);
})
.Sortable()
.Pageable()
.Scrollable()
.ClientDetailTemplateId("template")
.HtmlAttributes(new { style = "height:430px;" })
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(5)
.Read(read => read.Action("HierarchyBinding_Employees", "HierarchyGridDisplay"))
)
)
<script id="template" type="text/kendo-tmpl">
@(Html.Kendo().Grid<KendoSampleMVCApp.Models.ShipDescriptionModel>()
.Name("ChildGrids")
.Columns(columns =>
{
columns.Bound(o => o.ShipAddress).Width(70);
columns.Bound(o => o.ShipCountry).Width(70);
columns.Bound(o => o.ShipName).Width(70);
})
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(6)
.Read(read => read.Action("HierarchyBinding_Orders", "HierarchyGridDisplay"))
)
.Pageable()
.Sortable()
.ToClientTemplate()
)
</script>
<script>
function dataBound() {
this.expandRow(this.tbody.find("tr.k-master-row").first());
}
</script>
}
这是我的模型
public class EmployeesDetailsModel
{
public string EmployeeID { get; set; }
public string EmployeeFirstName { get; set; }
public string EmployeeSecondName { get; set; }
public string EmployeeCity { get; set; }
}
public class ShipDescriptionModel
{
public string ShipCountry { get; set; }
public string ShipAddress { get; set; }
public string ShipName { get; set; }
}
public class EmployeeShipModel
{
public EmployeesDetailsModel employeesshipments { get; set; }
public ShipDescriptionModel shipinfo { get; set; }
}
您能否提出任何想法和任何更改,以便将view
子网格数据也显示到另一行...非常感谢
请看下面附上的图片