Customserverbinding Groupable Statistics Problem

3 posts, 0 answers
  1. Ray
    Ray avatar
    3 posts
    Member since:
    Nov 2018

    Posted 12 Oct 2019 Link to this post

    Grid Custom Server Binding Data

    Group statistics have no data ,ClientGroupHeaderTemplate()  do not work;

    GroupHeaderTemplate(g=>g.Count),g.Count is Null

    Custom Server Binding  the way How to implement group statistics?

     

    Examples Code:

    @model System.Collections.IEnumerable
    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.Order>()
        .Name("Grid")
        .EnableCustomBinding(true)
        .BindTo(Model)
        .Columns(columns => {
            columns.Bound(o => o.OrderID).Groupable(false);
            columns.Bound(o => o.ShipCity).GroupHeaderTemplate(g=>g.Count);
            columns.Bound(o => o.ShipCountry).ClientGroupHeaderTemplate("ShipCountry: #= value # (Count: #= count#)");
            columns.Bound(o => o.ShipName);
        })
        .Pageable()
        .Sortable()
        .Filterable()
        .Scrollable()
        .Groupable()
        .DataSource(dataSource =>dataSource
            .Server()
            .Total((int)ViewData["total"])
            .Aggregates(aggregates =>
                {
                    aggregates.Add(p => p.ShipCountry).Count();
                }
            )
         )
    )
  2. Ray
    Ray avatar
    3 posts
    Member since:
    Nov 2018

    Posted 12 Oct 2019 Link to this post

    @model System.Collections.IEnumerable
     
    @(Html.Kendo().Grid<Kendo.Mvc.Examples.Models.Order>()
        .Name("Grid")
        .EnableCustomBinding(true)
        .BindTo(Model)
        .Columns(columns => {
            columns.Bound(o => o.OrderID).Groupable(false);
            columns.Bound(o => o.ShipCity).GroupHeaderTemplate(g=>g.Count);
            columns.Bound(o => o.ShipCountry).ClientGroupHeaderTemplate("ShipCountry: #= value # (Count: #= count#)");
            columns.Bound(o => o.ShipName);
        })
        .Pageable()
        .Sortable()
        .Filterable()
        .Scrollable()
        .Groupable()
        .DataSource(dataSource =>dataSource
            .Server()
            .Total((int)ViewData["total"])
            .Aggregates(aggregates =>
             {
                  aggregates.Add(p => p.ShipCountry).Count();
             }
            )
         )
    )
  3. Angel Petrov
    Admin
    Angel Petrov avatar
    1154 posts

    Posted 15 Oct 2019 Link to this post

    Hi Ray,

    A sample implementation on how to configure the grid is provided in this demo. Please examine the setup, apply the approach on your end and let us know how it goes.

    Regards,
    Angel Petrov
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top