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

How to get all filtered rows ?

4 Answers 44 Views
GridView
This is a migrated thread and some comments may be shown as answers.
TheRapidOne
Top achievements
Rank 1
TheRapidOne asked on 27 Oct 2011, 03:47 PM
Hi,

I'm looking for a way to get all filtered rows from RadGriwView. I'm using a RadDataPager which pagesize is set to 15. I used the following code, but this one returns me just displayed rows. ie : if there are no filters, it retunrs only 15 rows, while my observablecollection count is about 1200 elements.

Can someone help me please.

public static IEnumerable Leaves(this IEnumerable<IGroup> groups)
        {
            foreach (IGroup group in groups)
            {
                foreach (object item in group.Leaves())
                {
                    yield return item;
                }
            }
        }
 
        public static IEnumerable Leaves(this IGroup group)
        {
            if (group == null)
            {
                return Enumerable.Empty<object>();
            }
 
            if (!group.HasSubgroups)
            {
                return group.Items;
            }
 
            return group.Subgroups.Leaves();
        }
 
        public static IEnumerable FlatItems(this GridViewDataControl grid)
        {
            if (grid.IsGrouping)
            {
                return grid.Items.Cast<IGroup>().Leaves();
            }
 
            return grid.Items;
        }


ps : I use this code as an extension class. 

Thanks.

4 Answers, 1 is accepted

Sort by
0
TheRapidOne
Top achievements
Rank 1
answered on 27 Oct 2011, 11:30 PM
No reply :'(
0
Mike
Top achievements
Rank 1
answered on 02 Nov 2011, 02:03 PM
Hi,

Any solution for this problem?

0
Rossen Hristov
Telerik team
answered on 07 Nov 2011, 12:53 PM
Hi Radouan,

You can transform your sourceCollection to an IQueryable, and then use our Where method (located in Telerik.Windows.Data.QueryableExtensions) extension method passing the grid's FilterDescriptors as the parameter. 

Greetings,
Ross
the Telerik team

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

0
Mike
Top achievements
Rank 1
answered on 01 Dec 2011, 09:49 AM
Thanks ;)

this is it.
Tags
GridView
Asked by
TheRapidOne
Top achievements
Rank 1
Answers by
TheRapidOne
Top achievements
Rank 1
Mike
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or