I am trying to implement N-level nested hierarchy in Kendo UI Grid using ASP.NET MVC i can implement specific number of Nested Grid but how to implement N-level nested Grid using a Specific Data in asp.net MVC
@(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>
Using this code i can get 1 nested Grid.
Please guide about getting N-Level of Kendo Nested Grids. Thanks
I think is no way to do something like this because suck kind of data (tree) are displayed using treeview plugins or something like that , this should be more clearly , this is why even they have this kind of ui component.
Create partial views for each of your nested grids. The partial view grids will each have a ClientDetailTemplate.
You can achieve N-level Hierarchy using Kendo UI Grids.
You should have ClientDetailTemplateId in your templates. Here is the example.
Here is the implementation for child template.
Here is the output. Let me know if you have any more questions. I hope this will help you.