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

Filter Expressions

9 Answers 231 Views
DataFilter
This is a migrated thread and some comments may be shown as answers.
Ceramist
Top achievements
Rank 1
Ceramist asked on 02 Aug 2010, 05:13 AM
The FilterDescriptions in DataFilter permits collecting all the filters a user selects.  Is there a way to turn these into a valid LINQ expression?  For example, one user might set up a set of filters against a source in the UI that becomes the source for another user to interact.  One could always simply provide a DataFilter against the main source and save/restore the filterdescriptors, but a LINQ expression would be easier. 

9 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 02 Aug 2010, 12:30 PM
Hi Ceramist,

RadDataFilter exposes a collection called FilterDescriptors. This collection is updated whenever something changed in the filter. You can listen for this collection and use the information there for any kind of purpose. Currently, there is not out-of-the-box LINQ expression support since this is far from trivial.

And example of using the filter in unbound mode can be seen here. Basically, I have attached to the collection changed even of the filter descriptors and I am filtering a DomainDataSource. But you can do something similar and build/update your LINQ expression.

I hope this helps.
 
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
Sebastian Talamoni
Top achievements
Rank 1
answered on 24 Aug 2010, 04:33 PM
Hi Ross, 
I was testing/evaluating using RadGrid + RadPager + RadFilter in combination with RIA services.

Reading your reply I got stuck in this part :
"Currently, there is not out-of-the-box LINQ expression support since this is far from trivial."

When using Domain Data Source  (DDS) in combination with RADPager it's kind of "required" to send the LINQ expression to the server otherwise are only filtering the items loaded in (client)  memory and that's 98% of the cases not the expected behavior.

So currently, I am forced to use those 200 lines shown in the example:
http://demos.telerik.com/silverlight/#DataFilter/DomainDataSource

So my question is the following:
1) What's the difference between the implementation in the DomainDataSource example and the "out-of-the-box".
2) Why in the website you emphasis the integration with DomainDataSource if we need to do all this work translating RADGrid filters (and RADFilter filters) into linq expression.

I hope there is an easier way..

Any suggestion or ideas are more than welcome...

0
Rossen Hristov
Telerik team
answered on 25 Aug 2010, 08:27 AM
Hello Sebastian Talamoni,

It seems that there is some kind of misunderstanding.

Adding FilterDescriptors to a DomainDataSource is different from creating a LINQ expression by hand.

The DomainDataSource may be sending a LINQ expression to the server, but what we are doing is simply adding filter descriptors to it. There is a huge difference. RadDataFilter simply produces these FilterDescriptors -- it does not create the LINQ expression.

I hope this makes sense.

1. The implementation in the example is the only possible way for now. You have a DDS so you will not have to build a LINQ expression by hand and send it to the server. Use the DDS to do the job for you. That is its main purpose after all.

2. No one is translating Telerik FilterDescriptors to a LINQ expression. We are translating Telerik FilterDescriptors to the MS FilterDescriptros and attach them to the DomainDataSource. It does all the job from there on.

I hope this helps.

Best wishes,
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
Sebastian Talamoni
Top achievements
Rank 1
answered on 25 Aug 2010, 09:28 AM
Hi Ross,

True. I was confused and now I get the point, thanks for the clarification.
I think that now I can rephrase my point/question .

Issue#1 :  RADFilter does not automatically translate Filters to the DomainDataSource
Like you clearly stated, I would need to manually convert (RAD --> DDS) those filters as shown in the example.
Won't be better here to have  a derived RADFilterForDDS which supports better DDS and that will make that translation automatically?
I would like to know if this scenario is already in your DEV plans .


Issue#2 : RADGrid filtering does not automatically translates filters to the DDS.

RADGrid also contains it's own filter capabilities :  http://www.telerik.com/help/silverlight/gridview-basic-filtering2.html
Which in the presented scenario are useless.  If I have the following grid:
            <telerik:RadGridView Name="radGridView1"  
                                 AutoGenerateColumns="True"
                                 ItemsSource="{Binding ElementName=artistDomainDataSource, Path=Data}" />

Whatever filter I enter will only be applied to the currently shown Items and not to the ItemsSource, correct?
See attached image.
Am I supposed here to apply the same solution as in Issue#1 ?
I would like to know if this scenario (quite basic IMHO ) is already in your DEV plans .

That's why I still think that IMHO the support for RIA and DDS is quite poor.
Please don't get me wrong, I am a happy customer but don't want to jump into using RIA services without knowing that your controls are making my life easier.

Thanks in advance,

0
Rossen Hristov
Telerik team
answered on 25 Aug 2010, 09:54 AM
Hello Sebastian Talamoni,

1. That is correct. The DomainDataSource control is developed by Microsoft and RadDataFilter is developed by Telerik. As the developer of RadDataFilter I cannot tightly couple my control with a concrete third-party implementation. That is why I have provided a trivial integration example. Furthermore, Telerik has CompositeFilterDescriptors which cannot be translated to the Microsoft ones, since they do not have a counterpart provided by the DDS. This is the reason for the CanUserCreateCompositeFilters property of RadDataFilter.

2. There is a solution for this scenario and it is called Server-Side Filtering. You can learn more about it from my blog post. The alternative to this approach is to use RadDataFilter to filter the DDS like in the online example and then attach the grid to the DDS. It's up to you to decide which one to use.

The bottom-line is that we are doing our best to provide integration examples for our controls and Microsoft technologies, but we cannot go ahead and couple our controls with the Microsoft ones like this. Imagine what will happen if MS decide to change everything overnight and introduce breaking changes?

Don't get me wrong, but I cannot insert the following code in RadDataFilter (pseudo-code):

if (this.Source == DomainDataSource)
{
   // do something to handle the specific case where the Source is a DDS...
}

That's just plain wrong. That is why I am doing my best to provide the so-called integration examples, in which both parties (Telerik and MS) are totally unaware of the existence of the other one thus keeping them absolutely decoupled.

I hope this makes sense.

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
Sebastian Talamoni
Top achievements
Rank 1
answered on 25 Aug 2010, 12:45 PM
Hi Ross,

First of all thanks for such a great support!
Now at least I understand the reasons behind your decisions.

Here some loud thoughts :
  • I found it funny when you called Microsoft a 3rd Party.
  • As you already noticed I am a newbie to RIA services and I still have lot to learn. Maybe there is another "technique" or strategy to avoid using the DomainDataSource (and thus avoiding all this story) and still have the server side filtering (?). Please enlighten me with your wisdom ...
  • I think that 98% of the users will end up writing their own implementation of that example .
  • Taking the previous point into consideration, would it then be possible to have "besides" the product (which you don't want to compromise independence, etc) some kind of Contributor project where these things are just targeted?  
  • I've noticed that you have a Code Library (http://www.telerik.com/community/code-library/silverlight.aspx) can maybe this be the place for it?
  • In the contrib project you can then have a specialized RADFilter which internally implements that hook in the best possible way. Me as a user I just want to have the smallest XAML and cs possible, don't care about Telerik vs Microsoft company stories. I just want both things to work together without all that code.
  • So I think that if you basically take your own examples and create a derived RADFilter specialized in DomainDataSource would be great. It can be  "use it at your own risk"  kind of statement (maybe even open source) to save us (users) time .
  • My conclusion is : You have in your excellent examples everything figured it out but still there is a gap between the example and the consumers (us, the people).

Let me know if this makes sense otherwise I will start tomorrow creating "my own" implementation ..

Thanks again.
0
Rossen Hristov
Telerik team
answered on 25 Aug 2010, 01:22 PM
Hello Sebastian Talamoni,

- Even though Telerik develops products for the .NET platform, it is a company that is different from Microsoft, so that makes Microsoft a 3-rd party. Maybe I should have defined the term "3-rd party" as someone that you do not have control over. For example, if tomorrow Microsoft suddenly decide to discontinue or re-write from scratch WCF RIA Services (hypothetically of course) there is absolutely nothing that Telerik can do about it. This makes them a 3-rd party even though our relationship with them is a true symbiosis.

- In my opinion that can be classified as flexibility. Each user can tailor the reference implementation found in the example to his/her specific needs. We haven't got any complaints up to now. What people usually do is take the reference implementation and use it as the base for developing their specific business logic.

- I really don't think that there will be a whole separate project dedicated to creating a data filter that will work solely with the DomainDataSource. The code needed to make this is about 200 lines and it is publicly available.

We have plans for developing our own Domain Data Source control. You can vote for this feature here if you like.

Thanks for the feedback.

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
Sebastian Talamoni
Top achievements
Rank 1
answered on 25 Aug 2010, 01:41 PM
Ross,

  • Just added my vote for that feature.
  • It's clear that I will have to make my own implementation.
  • Flexibility is clearly in the case against productivity. 
  • I still think that marketing people went too far with adding support for RIA services in the main feature of the Silverlight with the following text which IMHO is a "little" misleading (well, what marketing piece isn't :) )...[Quoting from your http://www.telerik.com/products/silverlight.aspx]

WCF RIA Services support

All data-bound Telerik Silverlight controls support completely codeless binding to WCF RIA Services. This enables all data operations to execute on the server, which may result in quicker sorting, filtering and paging for RadGridView.



Topic is closed for me but if you read carefully the above statement don't be surprise to get more people with the same question.

Thanks for your patience.
0
Rossen Hristov
Telerik team
answered on 25 Aug 2010, 02:07 PM
Hi Sebastian Talamoni,

Thanks you for voting.

Once we implement our own DomainDataSource control, all of these issues will be gone. The more people vote for it -- the sooner we will start its implementation. I completely understand your position.

P.S. I want to apologize for the marketing stuff, but it is really not under my control. But you are completely right.

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
Tags
DataFilter
Asked by
Ceramist
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Sebastian Talamoni
Top achievements
Rank 1
Share this question
or