Hello,
I'm using server side aggregation. It works perfectly when reading data. But if an item is destroyed or updated the aggregate is not recalculated (my update/destroy response contains "aggregates" data).
For this reason, I need another request to server to read data again - which is not a case in our business application. Is this a known issue? Or maybe there is a workaround for that?
Thanks.
My datasource declaration:
viewModel = kendo.observable({ gridSource: new kendo.data.DataSource({ serverAggregates: true, transport: { read: function(options) { $.ajax({ url: "/ajax/getProducts", type: "GET", cache: false, dataType: "json", success: function(result) { options.success(result); } }); }, destroy: function (options) { var id = {id: options.data.id}; $.ajax({ url: "/ajax/deleteProduct", cache: false, type: "DELETE", contentType: "application/json", data: JSON.stringify(id), success: function(result) { options.success(result); }, error: function(result) { options.error(result); viewModel.gridSource.cancelChanges(); } }); }, update: function (options) { $.ajax({ url: "/ajax/updateItem", cache: false, type: "POST", contentType: "application/json", data: JSON.stringify(options.data), success: function(result) { options.success(result); }, error: function(result) { options.error(result); } }); } }, schema: { data: "data", aggregates: "aggregates", model: { id: "id", fields: { id: { type: "string" }, description: { type: "string" }, price: { type: "number" }, quantity: { type: "number" } } } }, aggregate: [ { field: "totalPrice", aggregate: "sum" } ] })
});
My destroy action json response:
{"totalSize":null,"data":[],"aggregates":{"totalPrice":{"sum":51.1}}}
Thank you!