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)
。