Problem getting filtered items count.

2 posts, 0 answers
  1. Niklas
    Niklas avatar
    8 posts
    Member since:
    Sep 2014

    Posted 13 Mar 2015 Link to this post

    I have a RadGridView that is using filters. And i have a RadDataPager with its source set to the "Items" of the RadGridView. I want to display the total number of filtered items in the grid. What is the best approach to get the number of filtered items? Since i use paging, i cant just count the visible rows in the grid. And i cant use the RadDataPager.PagedSource.ItemCount, since that value is not affected by the filtering. Is there no "FilteredItemsCount" i can use? ;)
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 16 Mar 2015 Link to this post

    Hi Nikita,

    When a pager is used, then only the items displayed on the current page will be available. If you access RadGridView.Items collection, there are all the items just on the current page as RadGridView is not aware there are further pages.


    Please note filtering is a data operation which means it is done by building and executing a LINQ query appending proper Where clause over the source collection. 

    That is why you can also execute such a query over the source collection directly to get all the filtered items based on the used defined filtering criteria. 
    For example:
    var listAllFilterItems = source.Where(a => a.Name == "Liverpool");


    All the filtering settings are available with each column's ColumnFilterDescriptor. Please check our online documentation where the filtering is explained in details.

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top