I have a Grid, with a KendoDataSource that provides the data. That grid has some aggregate data. The entire data sits in a KendoObservableObject in my VM.
I have another calculated field in the VM which shows the sum and count:
I would like have the TotalFiles and TotalSize as column values in another Grid (which is backed by a different VM DataSource. Is this sort of chaining possible?
01.
vm.SetLayers = function (values) {
02.
//this.LayerTable.data(values);
03.
//this.LayerTable.aggregate = [{ field: "FileCount", aggregate: "count" }];
04.
//this.trigger("change", { field: "LayerTable" });
05.
this.LayerTable = new kendo.data.DataSource({
06.
data: values,
07.
aggregate: [
08.
{ field: "FileCount", aggregate: "count" },
09.
{ field: "Size", aggregate: "sum" }
10.
]
11.
});
12.
this.trigger("change", { field: "LayerTable" });
13.
};
I have another calculated field in the VM which shows the sum and count:
01.
var totalFiles = function () {
02.
return this.LayerTable.aggregates().FileCount.count;
03.
};
04.
var totalSize = function () {
05.
return this.LayerTable.aggregates().Size.sum;
06.
};
07.
vm = kendo.observable({
08.
InfoTable: infoTable,
09.
LayerTable: layerTable,
10.
StatsTable: statsTable,
11.
TotalFiles: totalFiles,
12.
TotalSize: totalSize
13.
});
01.
var infoTable = [
02.
{ Item: "Status", Value: "Initializing" },
03.
{ Item: "XHR2", Value: false },
04.
{ Item: "B64", Value: false },
05.
{ Item: "PouchDB", value: "" },
06.
{ Item: "Center", Value: "xx" },
07.
{ Item: "Date", Value: "xx" },
08.
{ Item: "Zoom", Value: 0 },
09.
{ Item: "Total Files", Value: 0 },
10.
{ Item: "Total Size", Value: 0 }
11.
12.
];