or
[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>}using System;using System.Collections.Generic;using System.Linq;using System.Web.Services;public partial class KendoUI : System.Web.UI.Page{ protected void Page_Load(object sender, EventArgs e) { } [WebMethod] public static string GetJson() { System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer(); List<Dictionary<string, object>> rows = new List<Dictionary<string, object>>(); Dictionary<string, object> row; for (int i = 0; i <= 5; i++) { row = new Dictionary<string, object>(); row.Add("country", "Singapore"); row.Add("year", (2000 + i).ToString() ); row.Add("value", 50 + i); rows.Add(row); } return serializer.Serialize(rows); }}<%@ Page Language="C#" AutoEventWireup="true" CodeFile="KendoUI.aspx.cs" Inherits="KendoUI" %><!doctype html ><html><head runat="server"> <link href="KendoCSS/kendo.dataviz.min.css" rel="stylesheet" type="text/css" /> <script src="KendoJs/jquery.min.js" type="text/javascript"></script><script src="KendoJs/kendo.dataviz.min.js" type="text/javascript"></script><script src="KendoJs/kendo.data.min.js" type="text/javascript"></script></head><body> <form id="form1" runat="server"> <div> <div class="chart-wrapper"> <div id="chart" ></div> <div id="test" /> </div> </div> </form></body> <script> $(document).ready(function () { $.ajax({ type: "POST", url: "KendoUI.aspx/GetJson", contentType: "application/json; charset=utf-8", dataType: "json", success: function (data) { if (data != "") { $("#test").html(internetUsers); $("#chart").kendoChart({ theme: $(document).data("kendoSkin") || "default", dataSource: { data: internetUsers }, title: { text: "Internet Users" }, legend: { position: "bottom" }, seriesDefaults: { type: "line", labels: { visible: true, format: "{0}%" } }, series: [{ field: "value", name: "Singapore" }], valueAxis: { labels: { format: "{0}%" } }, categoryAxis: { field: "year" } }); } } }) }); </script></html> 