This project is read-only.

Displaying item counts

Apr 8, 2014 at 4:16 PM
I have seen in a demo program where the number of items is being displayed .. i.e.
"Displaying items x-y (z total)". I can't find any documentation for this and was wondering how to go about implementing it. I actually need to display this information at the top and bottom of the gird.
Apr 16, 2014 at 3:54 AM
Hi,

This feature was removed from default grid layout, because now grid support custom pager implementation, and the label requires select total items count.

To implement this you need to pass Grid<T> as Model to the view (please see source code for demo - https://gridmvc.codeplex.com/SourceControl/latest#GridMvc/GridMvc.Site/Models/Grids/OrdersGrid.cs and https://gridmvc.codeplex.com/SourceControl/latest#GridMvc/GridMvc.Site/Views/Home/_OrdersGrid.cshtml)

Then in the view - you can render the label:
@model GridMvc.Site.Models.Grids.OrdersGrid

<div class="grid-wrap-header">
    Results:
    @(((Model.Pager.CurrentPage - 1) * Model.Pager.PageSize) + 1)
    &ndash;
    @(((Model.Pager.CurrentPage - 1) * Model.Pager.PageSize) + Model.DisplayingItemsCount)
    of @Model.GridItems.Count()
</div>
Sep 29, 2014 at 3:58 PM
Whenever you get the time, could you please elaborate your answer? I really want to get that functionality back, but I can't get the above to work.