【问题标题】:KendoUI grid display total number of recordsKendoUI 网格显示总记录数
【发布时间】:2012-05-24 03:04:22
【问题描述】:

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

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

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

【问题讨论】:

    标签: asp.net-mvc kendo-ui


    【解决方案1】:

    您所要做的就是将其添加到您的 .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 =&gt; ev.DataBound("updateTotals")) 调用添加到 Html.Kendo().Grid(Model.Cases) 调用。
    【解决方案2】:

    我用来显示只有记录数的页脚(分页器)的 MVC 包装器代码如下所示:

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

    【讨论】:

      【解决方案3】:

      您可以使用选项 pageable.messages.display,您可以查看文档: Here

      【讨论】:

        猜你喜欢
        • 2018-08-26
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-08-07
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多