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

DetailInit event not firing

6 Answers 833 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 2
Dan asked on 24 Jun 2014, 06:19 PM
I have a parent grid / child grid. and I can't seem to get the two working properly.  Using the DetailInit event to set the data for the child grid, but the event is not even firing.  The grids are server bound with a model.  Here is the razor code.  Thanks for the help.
Dan

@model IEnumerable<EquipmentsSummary>
 
<div class="info-row">
    @(Html.Kendo().Grid(Model)
        .Name("EquipmentGrid")
        .Columns(columns =>
        {
            columns.Bound(e => e.EquipName).Title("Item Name");
            columns.Bound(e => e.SerialNo).Title("Serial #");
            columns.Bound(e => e.AssetStatus).Title("Status");
            columns.Bound(e => e.AssetStatusDate).Title("Date");
        })
        .HtmlAttributes(new { style = "height: 390px;" })
        .Pageable(pageable => pageable
            .PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
            .ButtonCount(5))
        .Sortable()
        .Filterable()
        .Scrollable()
        .DataSource(dataSource => dataSource
            .Ajax()
            .PageSize(20)
            .ServerOperation(false))
        .ClientDetailTemplateId("template")
        .Events(events => events.DetailInit("initDetail"))
    )
 
    <script id="template" type="text/kendo-tmpl">
        @(Html.Kendo().Grid<EquipmentSettingsSummary>()
            .Name(string.Format("SettingGrid_#=ID#"))
            .Columns(columns =>
            {
                columns.Bound(e => e.EffectiveDate).Title("Date");
                columns.Bound(e => e.AssetStatus).Title("Status");
            })
            .HtmlAttributes(new { style = "height: 390px;" })
            .Pageable(pageable => pageable
                .PageSizes(true).PageSizes(new int[] { 20, 50, 100 })
                .ButtonCount(5))
            .Sortable()
            .Filterable()
            .Scrollable()
            .ToClientTemplate()
        )
    </script>
    <script>
        function initDetail(e) {
            alert("ID is " + e.data.ID);
            var grid = $("#SettingGrid_" + e.data.ID).data("kendoGrid");
            grid.dataSource.data(e.data.SettingItems);
        }
    </script>
</div>

6 Answers, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 26 Jun 2014, 02:09 PM
Hi Dan,

This behavior is expected, because the detailInit event is not supposed to trigger when using server binding. In the current scenario I would recommend either using Ajax binding or moving the logic to the Grid's DetailExpand event.

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dan
Top achievements
Rank 2
answered on 26 Jun 2014, 03:32 PM
Alexander,
With the server binding, the parent grid is not even showing the row expansion icons.  I modeled this code after several examples that I have seen in the forum, but it is just not working.

Any ideas?
Thanks.
0
Accepted
Alexander Popov
Telerik team
answered on 30 Jun 2014, 08:34 AM
Hello again Dan,

You can find working examples of a hierarchical Grid using both Server and Ajax binding in the Kendo UI installation path, under the \wrappers\aspnetmvc\Examples directory. The files you would be interested in are:
  • Areas\razor\Views\grid\hierarchy.cshtml
  • Controllers\Grid\HierarchyController.cs
  • Areas\razor\Views\grid\serverhierarchy.cshtml
  • Controllers\Grid\ServerHierarchyController.cs

Regards,
Alexander Popov
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Dan
Top achievements
Rank 2
answered on 01 Jul 2014, 02:21 PM
Thank you.  The server binding example fixed my problem.

Dan
0
Gary
Top achievements
Rank 1
answered on 05 Oct 2015, 02:30 PM

Hello

I am having the same issue as described in this post. I have an updated Telerik distribution and the examples folder is no longer available (at least under MVC Q2 2014\wrappers\aspnetmvc... How can I find the sample that was listed as the resolution to this issue?

Thanks

0
Rosen
Telerik team
answered on 07 Oct 2015, 10:59 AM

Hello Gary,

 

Our records shows that you have downloaded the latest Q3 2015 (2015.3.930) version. Thus, you should check this installation folder. The sample application should be located under \wrappers\aspnetmvc\Examples.

 

Regards,
Rosen
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Dan
Top achievements
Rank 2
Answers by
Alexander Popov
Telerik team
Dan
Top achievements
Rank 2
Gary
Top achievements
Rank 1
Rosen
Telerik team
Share this question
or