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

Make CustomFilterDescriptor work with paging

5 Answers 128 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jonx
Top achievements
Rank 2
Jonx asked on 05 Aug 2010, 04:22 PM
Hello,
I used the filter as you type sample and it works nicely when I don't use a pager:
http://demos.telerik.com/silverlight/#GridView/Search

When I use a pager, only the rows of a given page a filtered.

What I want is to apply my filter to the whole set on the server...
and that I get back all the corresponding rows...

I understand that this can be lengthy but it is what I need...

Can someone help me on that please?
Thanks a lot in advance,
John.


5 Answers, 1 is accepted

Sort by
0
Yavor Georgiev
Telerik team
answered on 09 Aug 2010, 09:20 AM
Hello John,

 Unfortunately, RIA DomainDataServices does not yet support composite (complex) FilterDescriptors. There is no way to construct a filter that essentially translates to "Field1 = Value OR Field2 = Value OR Field3 = Value" and have the DDS pass it on to the server.

Best wishes,
Yavor Georgiev
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
Jonx
Top achievements
Rank 2
answered on 12 Aug 2010, 12:10 PM
Hello,
Thanks a lot for your answer. I'm sorry but I'm not sure to understand it...
I don't see what you mean with complex filters. Do you mean filters on more then one column?
In my case I only need one column anyway...

Do you think that this blog post is the solution I'm looking for:
http://blogs.telerik.com/rossenhristov/posts/10-03-24/pure_server-side_filtering_with_radgridview_and_wcf_ria_services.aspx

Or is this also not working with paging?
Thank you for your help,
John. 
0
Rossen Hristov
Telerik team
answered on 12 Aug 2010, 01:04 PM
Hi John,

My name is Rossen and I am the author of the mentioned blog post.

Long story short, when you have paging, there is only one page on the client at a time. When you use RadGridView's built-in filters you are performing the so-called client-side filtering, i.e. you are filtering only the data that is currently in memory on the client. Which is this one page.

On the other hand, my blog demonstrates how to prepare a custom filtering control which will perform filtering on the server-side, i.e. it will filter ALL available data and not only the current page.

By composite filters, my colleague means filters that have a logical operator (AND/OR) and one or more child filters. Telerik has a class called CompositeFilterDescriptor that does this. By using it you can create trees (hierarchies) of filters instead of having all filters on the same level. I will illustrate this with an example. Let's get all people that are not working and are from France (I am not sure about the ages :) ).

((Age IsLessThan 16) OR (Age IsGreaterThan 60)) AND (Country IsEqualTo 'France')

This is a composite filter with logical operator AND that has two child filters. One of them is a simple filter telling that the country should be France. The other is a composite filter with logical operator OR and two child filters. This is called composition thus the name CompositeFilterDescriptor.

Unfortunately, the DomainDataSource does not support such nesting, i.e. hierarchy. It can have all of its filters on the same level. In other words -- you cannot create the filter from my example and pass it to the DomainDataSource. They simply do not have an equivalent of our CompositeFilterDescriptor.

I have spoken with Microsoft and there is a chance that they will add this feature for a future release of WCF RIA Services, but this is out of my control.

But in your case I doubt that you will need to create complex hierarchies of filters like the one in my example.

Let me know if you have any other questions.

Kind regards,
Ross
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
Jonx
Top achievements
Rank 2
answered on 12 Aug 2010, 03:03 PM
Hello again Ross ;)

First let me tell you that I love your support guys. Thank you.
I'll buy my components first thing in the morning tomorrow...

So thank you for the detailed answer it makes more sense now...

My goal is "just" to filter my data with simple first level criteria.

And then indeed the solution you blogged about is what I'm looking for as it does work for all the data not only the data in the current page.

One last question. In your blog post a guy asks for some help to make you stuff work for non autogenerated columns...
Has that question come to a conclusion as I need to do the same thing and I guess that if people ask about it,
then it may not work right out of the box?

Thanks for letting me know,
John.

0
Accepted
Rossen Hristov
Telerik team
answered on 12 Aug 2010, 03:14 PM
Hi John,

Non-auto-generated columns are exactly the same as auto-generated. They are the same class and have a property called FilteringControl. You can set this property to be the custom filtering control either in XAML or in code-behind.

For example:

<telerik:GridViewDataColumn DataMemberBinding="{Binding Name}">
                    <telerik:GridViewDataColumn.FilteringControl>
                        <my:MyCustomFilteringControl/>                       
                    </telerik:GridViewDataColumn.FilteringControl>
                </telerik:GridViewDataColumn>

or

this.grid.Columns[0].FilteringControl = new MyCustomFilteringControl();

These two will do exactly the same thing.

I hope this helps. Let me know if there are difficulties along the way.

Greetings,
Ross
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
Tags
GridView
Asked by
Jonx
Top achievements
Rank 2
Answers by
Yavor Georgiev
Telerik team
Jonx
Top achievements
Rank 2
Rossen Hristov
Telerik team
Share this question
or