1
Kendo文档非常可怕,其中大部分都是针对纯JavaScript实现的。如何使用Kendo UI mvc扩展显示网格页脚值
我试图显示网格页脚值,我拼凑了一些样本一起来拿出以下但我的页脚值显示空白。
我看到请求中返回的值作为返回的JSON的一部分,但在模板中访问它们时,这些值似乎为空。
我试过(Sum)
和(Sum.Value)
虽然Sum.Value
返回一个错误,说sum属性为null。
@{ var g = Html.Kendo().Grid<OrderViewModel>()
.Name("Orders")
.Columns(c =>
{
c.Bound(p => p.OrderID).Title("ID").Width(80);
c.Bound(p => p.OrderDate).Width(105).Format("{0:d}").Title("Date");
c.Bound(p => p.Name).Title("Name").FooterTemplate(i => i.Count);
c.Bound(p => p.Company).Title("Company");
c.Bound(p => p.Email);
c.Bound(p => p.Phone).Title("Phone");
c.Bound(p => p.Total).Width(100).Format("{0:c}").FooterTemplate(@<text>@item.Sum</text>);
c.Bound(p => p.Approved).Width(100);
c.Command(command => { command.Edit().Text("​").UpdateText("​").CancelText("​"); }).Width(154);
})
.DataSource(d => d
.Ajax()
.Aggregates(aggregates => {
aggregates.Add(a => a.Total).Sum();
aggregates.Add(a => a.Name).Count();
})
.Read(a => a.Action("GetOrders", "Orders"))
.Update(a => a.Action("UpdateOrder", "Orders"))
.PageSize(10)
.Sort(sort => sort.Add("OrderDate").Descending())
.Model(model => model.Id(p => p.ID))
)
.Pageable()
.Sortable()
.Filterable()
.Editable(e => e.Mode(GridEditMode.InLine))
.Resizable(r => r.Columns(true));
@g
}
任何想法我失踪?
聚合物部分来自它们的样品,但同一样品不会显示模板本身。
我也试过算,但没有运气。看到我的绑定列(Name)
和(Total)
。