我正在使用Asp.Net KendoUI网格MVC助手,但无法使分页正常工作。具体来说,我无法获得要显示的总记录。这是代码:KendoUI MVC Helper Grid Paging
@(Html.Kendo().Grid(Model.FunctionList.AsEnumerable())
.Name("Grid")
.DataSource(dataSource => dataSource
.Server()
.Total(50)
.Model(model => model.Id(f => f.FunctionId))
.Read(read => read.Action("Index", "Function"))
.Update(update => update.Action("Edit", "Function"))
.Destroy(destroy => destroy.Action("Delete", "Function"))
)
.Columns(columns =>
{
columns.Bound(f => f.FunctionName);
columns.Bound(f => f.FunctionDescription);
columns.Command(command => { command.Custom("Edit").Action("Edit", "Function").SendDataKeys(true); command.Destroy(); }).Width(200);
})
.Scrollable()
.Groupable()
.Sortable()
.Pageable(pageable => pageable
.PageSizes(true)
.ButtonCount(5))
.Filterable(filterable => filterable
.Extra(false)
.Operators(ops => ops
.ForString(str => str.Clear()
.Contains("Contains")
.StartsWith("Starts with")
.EndsWith("Ends with")
.IsEqualTo("Equal to")
.IsNotEqualTo("Not Equal To")
)))
)
请注意.Total(50)。不管选择的页面大小(5,10或20),我只得到1页,即网格显示“n到n个项目”,其中n是页面大小。应当表示“1 -5 50的项目”为5页大小和总记录50.
生成的JavaScript(查看源)示出了总的(50)没有任何影响:
"pageSize":5,"page":1,"total":5,"serverPaging":true
通知 “总”:5,它应该是 “总”:50