【发布时间】:2012-05-24 03:04:22
【问题描述】:
我正在使用 kendoUI 网格来显示表格中的记录。我想显示表格的总记录数。像
显示 1203 条记录中的 1-20 条
有没有办法使用 KendoUI 网格显示记录总数?
【问题讨论】:
标签: asp.net-mvc kendo-ui
我正在使用 kendoUI 网格来显示表格中的记录。我想显示表格的总记录数。像
显示 1203 条记录中的 1-20 条
有没有办法使用 KendoUI 网格显示记录总数?
【问题讨论】:
标签: asp.net-mvc kendo-ui
您所要做的就是将其添加到您的 .kendoGrid
dataBound: function (e) {
//total bits needs to be removed because dataBound fires every time the gird pager is pressed.
$('#totalBits').remove();
//add the total count to the pager div. or whatever div you want... just remember to clear it before you add it.
$('.k-grid-pager').append('<div id="totalBits">' + this.dataSource.total() + '</div>')
}
【讨论】:
MVC 包装器,您可以添加它,例如在 Razor 视图中通过将 .Events(ev => ev.DataBound("updateTotals")) 调用添加到 Html.Kendo().Grid(Model.Cases) 调用。
我用来显示只有记录数的页脚(分页器)的 MVC 包装器代码如下所示:
@(Html.Kendo().Grid(dataSource)
.Columns(...)
.Pageable(p => p.Numeric(false)
.PreviousNext(false)
.Messages(m => m.Display("Matching Students: {2}")))
【讨论】:
您可以使用选项 pageable.messages.display,您可以查看文档: Here
【讨论】: