Aggregates with grouping doesn't work

0 Answers 109 Views
Grid
Logan
Top achievements
Rank 1
Veteran
Logan asked on 15 Feb 2022, 03:23 PM

My grid works with aggregates (Count, Average, Max) or with grouping, but not with both.  When i try to add a group when i have any columns that display aggregates it misaligns the columns and the drag/drops column header gets stuck (see screenshot).  The only fix is to refresh the page.

[pre group screenshot]

[post group screenshot]

[Grid Code]


    @(Html.Kendo().Grid<FullResultsView>()
        .Name(Model.GridName)
        .Columns(columns =>
        {
       columns.Bound(c => c.Code).Width(200);
        columns.Bound(c => c.FacilityIdWithName).Width(250).Title("Facility");
        columns.Bound(c => c.SampleType).Title("Sample Type").Width(120);
        columns.Bound(c => c.Result).Width(120).ClientFooterTemplate("Max:#=max#, Avg:#=average#").ClientGroupFooterTemplate("Max:#=max#, Avg:#=average#");
        columns.Bound(c => c.SequenceNumber).Title("Sequence Number").Hidden(true).Width(120);
        columns.Bound(c => c.RequiresReTest).Title("Requires Re-Test").Hidden(true).Width(120);
        })
        .ToolBar(tools => tools.Excel())
        .Scrollable(s => s.Endless(true).Height(200))
        .Filterable()
        .Sortable()
        .Groupable()
        .ColumnMenu(cm => cm.Enabled(true))
        .Resizable(resize => resize.Columns(true))
        .Reorderable(reorder => reorder.Columns(true))
        .Excel(excel => excel
        .FileName("Data Export.xlsx")
        .Filterable(true)
        .ProxyURL(Url.Action("Report_Export", "Report"))
        )
        .Editable(editable => editable.Enabled(false))
        .DataSource(Model.GridName+"dataSource").AutoBind(false)
        )

[Datasource Code]


        @(Html.Kendo().DataSource<FullLeadResultsView>()
        .Name(Model.GridName+"dataSource").Ajax(dataSource => dataSource
        .Sort(s => s.Add(sa => sa.ResultCreatedOnLocal).Descending())
        .PageSize(1000)
        .Events(events =>
        {
        events.Error("function(e){error_handler(e,'" + Model.GridName + "');}");
        })
        .Model(model =>
        {
        model.Id(m => m.Id);
        model.Field(f => f.Id).Editable(false);
        })
        .Aggregates(ag =>
        {
        ag.Add(f => f.Code).Count();
        ag.Add(f => f.Result).Average().Max();
        })
        .Read(read => read.Action("Report_Read", "Report", Model.Search).Data("onGridRead"))
        )
        )

 

Anton Mironov
Telerik team
commented on 18 Feb 2022, 09:53 AM

Hi Logan,

Thank you for the code snippets, the images, and the details provided.

As I can see from the second image, the "SampleType" drag icon is still available. This could be caused by an error.

Could you please double-check the Developer Tools Console for any JavaScript errors?

The following demo represents the implementation and behavior of using aggregates along with grouping for the Kendo UI Grid:

The fastest route to getting you up and running is if you could provide a runnable, isolated, sample project. Examining this project will let us replicate the issue locally and further troubleshoot it.

Looking forward to hearing back from you.


Kind Regards,
Anton Mironov

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Logan
Top achievements
Rank 1
Veteran
Share this question
or