or
.k-splitter { height: 300px; position: relative;}
01.var div = $("#divColours");02.var oid = "12312312", rnd = ((new Date()).getTime()).toString();03.div.kendoTreeView({04. dataTextField: "label",05. dataSource: new kendo.data.DataSource({06. type: "json",07. serverFiltering: false,08. transport: {09. read: function (options) {10. $.ajax({11. url: "Controllers/GenericController.ashx?rnd=" + rnd,12. dataType: "json",13. data: { "parms": ko.toJSON({ cmd: "coloursroot", sysoid: oid }) },14. contentType: "application/json; charset=utf-8",15. success: function (payLoad) {16. if (payLoad.Success) {17. var i = ko.toJSON(payLoad.Items);18. options.success(i);19. } else {20. };21. },22. error: function (jqXHR, textStatus, errorThrown) {23. debugger;24. },25. complete: function () {26. }27. })28. } //read29. },30. schema: {31. model: { hasChildren: false }32. } //transport33. }) //datasource34.});[Required(ErrorMessageResourceName = "GeburtstagFehlt", ErrorMessageResourceType = typeof(Resources.Shared.ValidationMessages))] [Display(Name = "Geburtstag", ResourceType = typeof(Resources.Models.Kontakt))] [DataType(DataType.Date, ErrorMessageResourceName = "GeburtstagUngueltig", ErrorMessageResourceType = typeof(Resources.Shared.ValidationMessages))] public DateTime Geburtstag { get; set; }@model DateTime?@(Html.Kendo().DatePickerFor(m => m))
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!.Columns(columns => { columns.Template(c => c.ContactID) .ClientTemplate("<a href=\"/Contacts/Details/#=ContactID#\">#=Name#</a>") .Title("Name"); columns.Template(c => c.Account.AccountName) .ClientTemplate("<a href=\"/Accounts/Details/#=AccountID#\">#=Account.AccountName#</a>") .Title("Account"); })
@for (int i = 12; i > 0; i--){ <text> { field: 'Month@(i).EHR', title: 'Month@(i)', template: '#if (Month@(i) != null) {#$#:Month@(i).EHR#.00 (#:Month@(i).TotalTime#)#} else {# #:"--"# #} #', width: 20 }, </text>}