eiu165
eiu165

Reputation: 6261

KendoUI grid display total number of records

I am using the kendoUI grid to show records from a table. I would like to display the total number of records so the table. something like

showing 1-20 of 1203 records

is there a way to show the total number of records using KendoUI grid?

Upvotes: 11

Views: 16977

Answers (3)

Steve Greene
Steve Greene

Reputation: 12304

The MVC wrapper code I used to display a footer(pager) with only the record count looked like this:

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

Upvotes: 2

OmarGR
OmarGR

Reputation: 11

You can use the option pageable.messages.display, you can review the documentation: Here

Upvotes: 1

DirtyKalb
DirtyKalb

Reputation: 155

All you have to do is add this to your .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>')
     }

Upvotes: 12

Related Questions