hierarchical grid not working

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

    Posted 12 Jul Link to this post

    I'm having a problem with a hierarchical grid: when I run my solution, the date doesn't show in the correct format, and because of that I can't see the child grid. But when I deploy the application, it does show correctly but it has an error, and I can't debug to solve it.

    Here is the grid:

    @(Html.Kendo().Grid(Model)
            .Name("OperacionesOCTVigentes")
            .DataSource(dataSource => dataSource
            .Ajax()
                .Read(read => read.Action("OperacionesOCTVigentes_Read", "Operaciones")
                .Data("ParametrosOCTVigentes"))
            .PageSize(30)
            .Aggregates(a =>
                {
                    a.Add(p => p.Compras).Sum();
                    a.Add(p => p.Ventas).Sum();
                    a.Add(p => p.Neto).Sum();
                    a.Add(p => p.MTM).Sum();
                })
            )
            .Columns(columns =>
            {
                columns.Bound(foo => foo.fecha_venc).Title(Global.Fecha).Format("{0:dd/MM/yyyy}").HtmlAttributes(new { @class = "grillaFecha" });
                columns.Bound(foo => foo.espe_codigo).Title(Global.Especie).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(foo => foo.clas_codigo).Title(Global.Clase).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(foo => foo.Compras).Title(Global.Compras).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
                columns.Bound(foo => foo.Ventas).Title(Global.Ventas).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
                columns.Bound(foo => foo.Neto).Title(Global.Neto).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
                columns.Bound(foo => foo.MTM).Title(Global.Capital).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" }).ClientFooterTemplate("#= kendo.format('{0:N}', sum)#");
            })
            .ClientDetailTemplateId("template")
        )

    And this is the child grid:

    <script id="template" type="text/kendo-tmpl">
        @(Html.Kendo().Grid<SGMTrade.DAL.ViewModels.OperacionesOCTPorFecha>()
                    .Name("grid2_#=row#")// "grid2_#=fecha_venc#
            .DataSource(dataSource => dataSource
                .Ajax()
                .PageSize(10)
                .Read(read => read.Action("OperacionesOCTPorFecha_Read", "Operaciones", 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>").HtmlAttributes(new { @class = "grillaNumero" });
                columns.Bound(o => o.oper_forigen).Title(Global.FechaOrigen).Format("{0:dd/MM/yyyy}").HtmlAttributes(new { @class = "grillaFecha" });
                columns.Bound(o => o.espe_codigo).Title(Global.Especie).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(o => o.clas_codigo).Title(Global.Clase).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(o => o.clie_nombre).Title(Global.Cliente).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(o => o.tope_suma).Title(Global.CompraOVenta).HtmlAttributes(new { @class = "grillaTexto" });
                columns.Bound(o => o.oper_monto).Title(Global.Capital).Format("{0:N}").HtmlAttributes(new { @class = "grillaNumero" });
                columns.Bound(o => o.oper_plazo).Title(Global.Plazo).HtmlAttributes(new { @class = "grillaNumero" });
                columns.Bound(o => o.Fecha_Vence).Title(Global.FechaVence).Format("{0:dd/MM/yyyy}").Hidden(true).HtmlAttributes(new { @class = "grillaFecha" });
                columns.Bound(o => o.precio_transf).Title(Global.PrecioTransferencia).HtmlAttributes(new { @class = "grillaNumero" });
                columns.Bound(o => o.spread).Title(Global.Spread).HtmlAttributes(new { @class = "grillaNumero" });
            })
            .Pageable()
            .Sortable()
            .Selectable()
            .Scrollable(s => s.Height(100))
            .Resizable(resize => resize.Columns(true))
            .Reorderable(reorder => reorder.Columns(true))
            .Filterable(ftb => ftb.Mode(GridFilterMode.Menu))
            .ToClientTemplate()
        )

    </script>

     

    In the first attached file it can be seen how the parent grid displays, and in the second one it can be seen that since the date format is incorrect, it can't perform the desired action (show details from database).

     

    What can I do? Thanks in advance

  2. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 14 Jul Link to this post

    Hello Matias,

    Could you please try to reproduce the issue with the attached fully runnable sample that contains the model, view and the controller files and then send it back to us for further investigation?

    Regards,
    Danail Vasilev
    Telerik by Progress
    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
  4. Matias
    Matias  avatar
    24 posts
    Member since:
    Mar 2016

    Posted 25 Jul in reply to Danail Vasilev Link to this post

    Hi,

    I've looked at the code and using the ID as a parameter in the Read Action works fine for me too. My problem is when I need to pass a Date variable to the server, that's when the browser converts it to ISO format instead of a dd/MM/yyyy string. Numbers and strings pass just fine.

    Thanks.

  5. Matias
    Matias  avatar
    24 posts
    Member since:
    Mar 2016

    Posted 25 Jul in reply to Matias Link to this post

    Sorry, wrong reply.

    My problem seems to be the browser, since I run the solution on IE and the date displays correctly, but that's not the case of Chrome. I'll continue the research.

    Thanks.

  6. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 26 Jul Link to this post

    Hi Matias,

    You may also find useful the following resoruces that treat similar issues:

       - http://stackoverflow.com/questions/3933245/asp-net-mvc-passing-json-datetime-to-controller-not-mapping-to-controller-para
       - http://blog.falafel.com/passing-dates-kendo-ui-aspnet/

    Regards,
    Danail Vasilev
    Telerik by Progress
    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
Back to Top
UI for ASP.NET MVC is VS 2017 Ready