KendoUI网格显示总记录数

时间:2012-05-16 14:13:59

标签: asp.net-mvc kendo-ui

我使用kendoUI网格显示表中的记录。我想显示表的总记录数。

之类的东西

显示1203条记录中的1-20条

有没有办法显示使用KendoUI网格的记录总数?

3 个答案:

答案 0 :(得分:10)

您只需将此添加到.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>')
     }

答案 1 :(得分:1)

您可以使用pageable.messages.display选项,您可以查看文档:{​​{3}}

答案 2 :(得分:1)

用于显示只有记录计数的页脚(寻呼机)的MVC包装器代码如下所示:

@(Html.Kendo().Grid(dataSource)
    .Columns(...)
    .Pageable(p => p.Numeric(false)
                    .PreviousNext(false)
                    .Messages(m => m.Display("Matching Students: {2}")))