This is a migrated thread and some comments may be shown as answers.

Grid with Multi-Level-Hierachy

3 Answers 468 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Patrick
Top achievements
Rank 1
Patrick asked on 25 Oct 2017, 09:49 AM

Hello, I want to create a grid with multi level hierachy, but the grid only shows to levels of hierachy. Here is the code of my view:

<div class="col-sm-12" id="main">
            @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MachineInfo>()
        .Name("grid")
        .ToolBar(tools => tools.Pdf())
        .Columns(columns =>
        {
            columns.Bound(o => o.msn_pkfk_serialnr_vchar);
            columns.Bound(o => o.mtp_pkfk_gang_vchar);
            columns.Bound(o => o.mtp_pkfk_mcid_vchar);
            columns.Bound(o => o.msb_kunde_vchar);
        })
        .HtmlAttributes(new { style = "height: 800px; width:1000px" })
        .Scrollable(scrollable => scrollable.Height("auto"))
        .Groupable()
        .Sortable()
        .ClientDetailTemplateId("TemplateMaterial")
        .Pageable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(10)
            .Read(read => read.Action("getSpGrid", "Home"))
        )
        .Events(events => events.DataBound("dataBound"))
            )
        </div>
    </div>
     
</div>
<script id="TemplateMaterial" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.MaterialInfo>()
            .Name("grid_#=msn_pkfk_serialnr_vchar#") // template expression, to be evaluated in the master context
            .ClientDetailTemplateId("TemplateFacility")
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .Read(read => read.Action("HistorianBinding_Material", "Home", new { SerialNr = "#=msn_pkfk_serialnr_vchar#" }))
            )
            .Sortable()
            .ToClientTemplate()
 
    )
</script>
<script id="TemplateFacility" type="text/kendo-tmpl">
    @(Html.Kendo().Grid<CMG_Configuration_Manager.Models.FacilityInfo>()
            .Name("grid_#=bgp_pkfk_bgpnr_vchar#") // template expression, to be evaluated in the master context
            .ClientDetailTemplateId("TemplateModule")
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(5)
                .Read(read => read.Action("HistorianBinding_Facility", "Home", new { GroupName = "#=bgp_pkfk_bgpnr_vchar#" }))
            )
            .Sortable()
            .ToClientTemplate()
 
    )
</script>

 

The grid shows the first and second level. At each row of second level is this little arrow to expand the data (where the third level should show up), but when i press the arrow the following error occurs:

Uncaught TypeError: Cannot read property 'replace' of undefined
    at Object.compile (kendo.all.min.js:25)
    at Object.d [as template] (jquery.min.js:2)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:1:4106)
    at Object.n [as syncReady] (kendo.aspnetmvc.min.js:25)
    at eval (eval at <anonymous> (jquery.min.js:2), <anonymous>:1:7)
    at eval (<anonymous>)
    at jquery.min.js:2
    at Function.globalEval (jquery.min.js:2)
    at Ha (jquery.min.js:3)
    at n.fn.init.after (jquery.min.js:3)

Can anybody help or has an idea to do the trick on .net Core MVC?

Regards

Patrick

3 Answers, 1 is accepted

Sort by
0
Patrick
Top achievements
Rank 1
answered on 26 Oct 2017, 08:43 AM

I found it out by myself.

Topic can be closed

0
Patrick
Top achievements
Rank 1
answered on 26 Oct 2017, 08:43 AM

I found it out by myself.

Topic can be closed

0
Stefan
Telerik team
answered on 30 Oct 2017, 07:36 AM
Hello, Patrick,

I'm glad that the issue is resolved.

In general, the following example can be used as a reference when making a Grid with Multi-Level-Hierarchy. The example is for MVC 5, but the implementation for the ASP.NET Core wrappers is similar:

https://docs.telerik.com/aspnet-mvc/helpers/grid/how-to/editing/edit-three-level-hierarchical-grid

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Patrick
Top achievements
Rank 1
Answers by
Patrick
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or