Hello,
I am having issues with the aggregate result returning incorrect values.
this.data = new kendo.data.DataSource({
transport: {
read: (e) => {
....
}
},
schema: <
kendo.data.DataSourceSchemaWithOptionsModel
> {
data: 'Data',
model: <
kendo.data.DataSourceSchemaModelWithFieldsObject
> {
fields: {
Foo: {
type: 'number',
editable: false,
parse: x => x.toFixed(2)
},
Bar: {
type: 'number',
editable: false,
parse: x => x.toFixed(2)
},
Qux: {
type: 'number',
editable: false,
parse: x => x.toFixed(2)
}
}
}
},
aggregate: [
{ field: 'Foo', aggregate: 'average' },
{ field: 'Bar', aggregate: 'average' },
{ field: 'Qux', aggregate: 'average' }
],
sort: {
field: 'TimeSlot',
dir: 'asc'
}
});
console.log(this.data);
This returns the last row of data returned ie:
this.data._aggregateResult:
Foo.average: 19
Bar.average: 90
Qux.average: 100
and this.data._data[this.data._data.length] contains:
Foo: 19
Bar: 90
Qux: 100
Instead of creating the average/max/min/sum the aggregate just returns data from the last object in the list.