<% this.Html.Kendo().Grid<EditablePlanejamentoDescarga>() .Name("GridPlanejamento") .Columns(columns => { columns.Bound(c => c.TransportadorNome) .Width(500) .HeaderHtmlAttributes(new { style = "text-align: center; font-weight: bold" }) .ClientFooterTemplate(" TOTAIS :") .FooterHtmlAttributes(new { style = "background-color:lightgray; text-align: right; font-weight :bold" }); columns.Bound(c => c.Domingo) .Width(175) .HtmlAttributes(new { style = "text-align: center" }) .HeaderHtmlAttributes(new { style = "text-align: center; font-weight: bold" }) .ClientTemplate("#= Domingo.QuantidadeFardos >0 ? Domingo.QuantidadeFardos :'' #") .ClientFooterTemplate("#=sum#") .FooterHtmlAttributes(new { style = "background-color:lightgray; text-align: right; font-weight :bold" }); columns.Bound(c => c.SegundaFeira) .Width(175) .HtmlAttributes(new { style = "text-align: center" }) .HeaderHtmlAttributes(new { style = "text-align: center; font-weight: bold" }) .ClientTemplate("#= SegundaFeira.QuantidadeFardos >0 ? SegundaFeira.QuantidadeFardos :'' #") .ClientFooterTemplate("#=sum#") .FooterHtmlAttributes(new { style = "background-color:lightgray; text-align: right; font-weight :bold" }); columns.Bound(c => c.TotalTransportador) .HtmlAttributes(new { style = "background-color:lightgray; text-align: right; font-weight :bold" }) .HeaderHtmlAttributes(new { style = "text-align: center; font-weight: bold" }) .ClientTemplate("#= TransportadorNome == '' ? '' : TotalTransportador #") .ClientFooterTemplate("#=sum#") .FooterHtmlAttributes(new { id = "footerTotal", style = "background-color:lightgray; text-align: right; font-weight :bold" }); }) .DataSource(dataSource => { dataSource.Ajax().Batch(true).ServerOperation(false); dataSource.Ajax().Model(m => { m.Id(i => i.TransportadorNome); m.Field(f => f.TransportadorNome).Editable(false); m.Field(f => f.TotalTransportador).Editable(false); }); dataSource.Ajax().Aggregates(agg => { agg.Add(a => a.Domingo.QuantidadeFardos).Sum(); agg.Add(a => a.SegundaFeira.QuantidadeFardos).Sum(); agg.Add(a => a.TotalTransportador).Sum(); }); }) .ToolBar(toolbar => { toolbar.Save(); }) .Editable(e => e.Mode(Kendo.Mvc.UI.GridEditMode.InCell)) .Navigatable(n => n.Enabled(true)) .Events(e => e.DataBound("onDataBound").Edit("onEdit").Save("onSave")) .Render(); %>For columns c.Domingo and c.SegundaFeira the agg.Add(a => a.Domingo.QuantidadeFardos).Sum() and agg.Add(a => a.SegundaFeira.QuantidadeFardos).Sum() don't works.
I'm using a .ClientTemplate("#= SegundaFeira.QuantidadeFardos >0 ? SegundaFeira.QuantidadeFardos :'' #") to show cell value.
JavaScritp erro occours ' sum' is undefined.
But for the c.TotalTransportador columns works correctly.
Thanks,
Tiago.