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

Hierarchy Grid with Local Data

1 Answer 116 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 29 Aug 2012, 01:04 PM
Hi,


I'm trying to create an Hierarchy Grid with Local Data and I can't manage to pass the father ID to the Client Detail Template


for example


@(Html.Kendo().Grid(Model.Employees)
        .Name("Employees")
        .Columns(columns =>
        {
            columns.Bound(e => e.FirstName).Width(140);
            columns.Bound(e => e.LastName).Width(140);
            columns.Bound(e => e.Title).Width(200);
            columns.Bound(e => e.Country).Width(200);
            columns.Bound(e => e.City);
        })
        .ClientDetailTemplateId("employeesTemplate")
        .Pageable()
        .DataSource(dataSource => dataSource        
       .Ajax()
   .ServerOperation(false)        
        )
        .Sortable()
)


<script id="employeesTemplate" type="text/kendo-tmpl">
    @(Html.Kendo().Grid(Model.Orders.Where(o=>o.employeeID == "#=EmployeeID#" ) )
           //************* NOT WORKING *************
            .Name("Orders_#=EmployeeID#")
            .Columns(columns =>
            {
                columns.Bound(o => o.OrderID).Width(101);
                columns.Bound(o => o.ShipCountry).Width(140);
                columns.Bound(o => o.ShipAddress).Width(200);
                columns.Bound(o => o.ShipName).Width(200);
            })
            .DataSource(dataSource => dataSource        
        .Ajax()
.ServerOperation(false)        
)
            .Pageable()
            .Sortable()
            .ToClientTemplate()
    )
</script>

Please Help

1 Answer, 1 is accepted

Sort by
0
Tag
Top achievements
Rank 1
answered on 16 Oct 2012, 06:40 PM
Yes, I'm trying to do the same thing. Seems like it shoudl be trivial to specify a property on the parent object as the datasource for the child records using a local data model. Too bad the Razor examples are incomplete. My

.Name(

"CustomFields_#=ID#")
Also throws and error 

 

Tags
Grid
Asked by
David
Top achievements
Rank 1
Answers by
Tag
Top achievements
Rank 1
Share this question
or