This project is read-only.

Pass total records to pager?

Oct 23, 2014 at 11:19 PM
I have a problem where I have to hook up the grid to a wcf service that accepts the paging parameters (current page and page size) and passes back the total records. Is there any way I can override the paging behavior to allow this? Do I need to create my own pager implementation, and if so is there an example somewhere?
Oct 27, 2014 at 7:15 PM
Nvm, I got it to work by creating my own paging implementation that mirrored most of the current grid's pager with the exception of the counts, etc and then created helper methods to get the current page and page count. I also added in the ability to switch page sizes that seems to be working ok:
<div class="pull-right">
        <ul class="pagination">
            <li class="@(Model.PageSize == 5 ? "active" : "")"><a href="?grid-page-size=5">5</a></li>
            <li class="@(Model.PageSize == 10 ? "active" : "")"><a href="?grid-page-size=10">10</a></li>
            <li class="@(Model.PageSize == 20 ? "active" : "")"><a href="?grid-page-size=20">20</a></li>
Mar 22, 2015 at 10:24 PM
I am having trouble doing paging with gridmvc connected to wcf, the grid shows up but no paging. There are total 20 records i am getting from wcf, but only first 5 show up and there is no paging showing up. Can you show me the code how you have implement IGridPager, for paging to work?

CustomGridPager pager = new CustomGridPager();
pager.PageSize = 5;

 @Html.Grid(Model.Appointments, GridRenderOptions.Create("gridAppointments")).Named("gridAppointments").Columns(columns =>
                        @Html.Partial("_GridPager", Model.CustomGridPager as CustomGridPager)   ------------------->  __PageCount is always zero in _GridPager.cshtml model__