or
<script id="WorkOrderGridRowTemplate" type="text/x-kendo-template"> <tr> <td> ${workorderreference} </td> <td> ${clientdestination} </td> <td> ${productreference} </td> <td> ${orderquantity} </td> <td> ${unitofmeasure} </td> <td> ${releasedate} </td> <td> ${quotedduedate} </td> <td> ${currentsequenceindex} </td> <td> # if (bufferpenetrationpercentage > 100) { # <span class="bufferPenetrationBlack">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 66) { # <span class="bufferPenetrationRed">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 33) { # <span class="bufferPenetrationYellow">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage > 0) { # <span class="bufferPenetrationGreen">${bufferpenetrationpercentage}</span> # } else if (bufferpenetrationpercentage <= 0) { # <span class="bufferPenetrationBlue">${bufferpenetrationpercentage}</span> # } else { # ERROR: ${ bufferpenetrationpercentage } # } # </td> </tr> </script>$("#divWorkOrderGrid").kendoGrid({ dataSource: { data: <%= _JsWorkOrderRecords %> }, rowTemplate: kendo.template($("#WorkOrderGridRowTemplate").html()), height: "auto", scrollable: false, sortable: true, groupable: true, pageable: false, columns: [ { field: "workorderreference", title: "W/O Ref." }, { field: "clientdestination", title: "Client/Destination" }, { field: "productreference", title: "Product Ref." }, { field: "orderquantity", title: "Order Quantity" }, { field: "unitofmeasure", title: "UoM" }, { field: "releasedate", title: "Release Date" }, { field: "quotedduedate", title: "Quoted Due Date" }, { field: "currentsequenceindex", title: "Current Sequence Index" }, { field: "bufferpenetrationpercentage", title: "Buffer Penetration (%)" } ] }); function playVideoNow() { jwplayer("details-container").setup({ file: "https://www.contoso.com/example.m4v", image: "https://www.contoso.com/example.png"}); <script type="text/x-kendo-template" id="template"> <div id="details-container"> <h2>Video Name</h2> <em>Video Date</em> <dl> <dt>Some Info: </dt> <dt>Some More Info:</dt> </dl> </div># window.onload = playVideoNow() # </script>.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"); })