This is a migrated thread and some comments may be shown as answers.

Row count info when paging or filtering

7 Answers 436 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
boris
Top achievements
Rank 1
boris asked on 24 Jun 2010, 10:39 AM
Hello,
I am trying to implement a status bar that shows number of total rows, as well as number of filtered rows when applying a filter to an ItemsSource.
Trouble I am having is that I do not know number of filtered rows when I am using a pager: Grid.Items.Count is just showing Pager.PageSize because that is how many records there are in the grid when paging.
Another problem I have is that I can never catch "Filtering" or "Filtered" event, maybe because I am doing filtering programmatically by setting FilterDescription manualy..
How can I find out what is the number of filtered rows?

7 Answers, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 25 Jun 2010, 04:38 PM
Hello boris,

 
You need to use as a source QueryableCollectionView and its ItemCount to return the number of filtered items. Thus count of the shown items will be equal to all of them and not only to those on the current page. I am sending you a sample code so that you can test the proposed solution.


Kind regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
boris
Top achievements
Rank 1
answered on 28 Jun 2010, 10:31 AM
Hello Maya , 
Thank you for your answer.
However, my scenario is bit specific for the proposed solution. I am using a MVVM patern, and my grid is two-way bound to an ItemsSource in my model, but my model cannot be aware of the Telerik's QueryableCollectionView  implementation, not to mention that I am using some dynamic data types with a custom DataTable implementation  :S
0
Maya
Telerik team
answered on 01 Jul 2010, 08:20 AM
Hi boris,

 
Another possible and applicable-in-every-case solution is to use Items.ItemCount and to bind the TextBlock to it. Items.ItemCount gets the number of known items in the view before paging is applied.
Thus your xaml file will be:

<telerikGrid:RadDataPager Name="radDataPager"
                Source="{Binding Items, ElementName=radGridView}"
                PageSize="5"
                IsTotalItemCountFixed="True"
                DisplayMode="All"/>
<TextBlock Grid.Row="2" Text="{Binding Items.ItemCount, ElementName=radGridView}" />

I am sending you the sample project so that you can use it as a reference.

Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
boris
Top achievements
Rank 1
answered on 02 Jul 2010, 09:14 AM
Hi Maya,
That is the property I needed :)
Tnx
0
Bryce
Top achievements
Rank 1
answered on 05 Apr 2012, 06:37 PM
Hi Maya,

This is also what I was looking for. However, I noticed if someone does a group by, the number will be changed to how many groups are created instead of still showing the number of total rows, or in this case the summation of all rows within the groups. I use the count aggregate to show how many rows are in each group already, and would like the textblock example you gave to still show the total number of rows.

Thanks,
Bryce
0
Bryce
Top achievements
Rank 1
answered on 06 Apr 2012, 11:31 PM
0
Maya
Telerik team
answered on 09 Apr 2012, 07:41 AM
Hi Bryce,

I am glad that you found an appropriate solution for you scenario. Let us know in case you need further assistance. 

All the best,
Maya
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
GridView
Asked by
boris
Top achievements
Rank 1
Answers by
Maya
Telerik team
boris
Top achievements
Rank 1
Bryce
Top achievements
Rank 1
Share this question
or