Asp.net-Mvc

KendoUI 網格顯示總記錄數

  • January 6, 2017

我正在使用 kendoUI 網格來顯示表中的記錄。我想顯示表格的總記錄數。就像是

顯示 1203 條記錄中的 1-20 條

有沒有辦法使用 KendoUI 網格顯示記錄總數?

您所要做的就是將其添加到您的 .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 包裝器程式碼如下所示:

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

引用自:https://stackoverflow.com/questions/10620442