Hierarchical grids - child grids display data only when opened from bottom to top

2 posts, 0 answers
  1. Matias
    Matias  avatar
    24 posts
    Member since:
    Mar 2016

    Posted 20 Apr Link to this post

    There's something strange going on with a hierarchical grid: the parent grid displays the data correctly, but when trying to display the data of the child grids, they only display everything when opening them from the last row to the first one.

    These are my grids:
    PARENT GRID:
    @(Html.Kendo().Grid(Model)
            .Name("ParentGrid")
            .DataSource(dataSource => dataSource
            .Ajax()
                .Read(read => read.Action("Read", "controller")
                .Data("ParameterFunction"))
            .PageSize(30)
            )
            .Columns(columns =>
            {
                columns.Bound(foo => foo.fecha_venc).Title(Global.Fecha).Format("{0:dd/MM/yyyy}"); //This is the date I need formatted
                columns.Bound(foo => foo.espe_codigo).Title(Global.Especie);
                columns.Bound(foo => foo.clas_codigo).Title(Global.Clase);
                
            })
            .ClientDetailTemplateId("template")
        )

    CHILD GRID:
    @(Html.Kendo().Grid<SGMTrade.DAL.ViewModels.OperacionesOCTPorFecha>()
            .Name("ChildGrid")
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Read(read => read.Action("childGrid_Read", "controller", new { fecha = "#=fecha_venc#", especie = "#=espe_codigo#", cliente = @ViewBag.cliente, clase = "#=clas_codigo#" }))
            )
            .Columns(columns =>
            {
                columns.Bound(o => o.oper_numero).Title(Global.NumeroOperacion)
                .ClientTemplate("<a href='\\\\\\#' onclick=\"showDetails('\\#=oper_numero\\#')\">\\#=oper_numero\\#</a>");
                columns.Bound(o => o.oper_forigen).Title(Global.FechaOrigen).Format("{0:dd/MM/yyyy}");
                columns.Bound(o => o.espe_codigo).Title(Global.Especie);
                columns.Bound(o => o.clas_codigo).Title(Global.Clase);
            })
            .ToClientTemplate()
        )

    As it can be seen in the first attachment, if I display the second child grid first and then the first grid, I'm able to display every data, but if I go for the first child grid, the data from the second child grid is not displayed.

    I analysed the code and I get the data from the stored procedure just fine, but I can't see it in the view.

    Thank you very much.

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 25 Apr Link to this post

    Hi Matias,

    Please examine the following example that illustrates how you can implement hierarchical grid. Ensure that you have configured the Name for the child grid to be unique value.



    Regards,
    Viktor Tachev
    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
  3. UI for ASP.NET MVC is VS 2017 Ready
Back to Top