Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 570
eiu165 Avatar asked May 16 '12 14:05

eiu165


2 Answers

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>')
     }
like image 158
DirtyKalb Avatar answered Oct 06 '22 01:10

DirtyKalb


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}")))
like image 42
Steve Greene Avatar answered Oct 05 '22 23:10

Steve Greene