telerik / kendo-angular

Issue tracker - Kendo UI for Angular
http://www.telerik.com/kendo-angular-ui/
Other
464 stars 213 forks source link

[Grid] Selection Aggregate does not work when binding GridDataResult #4265

Open mbechev opened 3 months ago

mbechev commented 3 months ago

Describe the bug When binding the Grid to a GridDataResult object, the selection aggregates aren't calculated. Only count is available.

This limitation comes from the fact that GridDataResult is an object with two properties, whereas the selection aggregates logic relies on arrays.

see selection.aggregate.service.ts file:

    public init(): void {
        if ((this.ctx.grid.selectable as SelectableSettings).cellAggregates) {
            this.data = this.dataChanges.data ? this.dataChanges.data : this.ctx.grid.data;
             ...
        }
    }

this.ctx.grid.data requires one more level deep to access the actual collection (this.ctx.grid.data.data).

To Reproduce Select a range of cells. https://stackblitz.com/edit/angular-ygxfpt-nj5g7l?file=src%2Fapp%2Fapp.component.ts

Possibly related to https://github.com/telerik/kendo-angular/issues/4201