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

hierarchical grid not working

4 Answers 235 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matias
Top achievements
Rank 1
Matias asked on 12 Jul 2016, 02:51 PM

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

4 Answers, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 14 Jul 2016, 11:51 AM
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
0
Matias
Top achievements
Rank 1
answered on 25 Jul 2016, 03:35 PM

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.

0
Matias
Top achievements
Rank 1
answered on 25 Jul 2016, 07:29 PM

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.

0
Danail Vasilev
Telerik team
answered on 26 Jul 2016, 08:38 AM
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
Tags
Grid
Asked by
Matias
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Matias
Top achievements
Rank 1
Share this question
or