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

Iterating over DataSourceRequest Filters

2 Answers 433 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Lukasz
Top achievements
Rank 1
Lukasz asked on 10 Sep 2013, 12:04 PM
We used to iterate over DataSourceRequest filters like this:
foreach (var filter in request.Filters)
{
          var descriptor = filter as FilterDescriptor;
          if (descriptor != null)
          {
               //do stuff
           }
}
Since we moved to Q3(v2013.2.906) this simple solution no longer works. With 2 or more filters applied to datasource, requestFilter is single CompositeFilterDescriptor with 2 children, CompositeFilterDescriptor and FilterDescriptor, and so long.
Is this a feature or a bug? If this is a feature is there any elegant solution to 'do stuff' or turn it off and get back to good old FilterDescriptor collection?

Right now we're using crude recursion to preprocess the filters, but that does not feel quite right. ;-) 

2 Answers, 1 is accepted

Sort by
0
Accepted
Daniel
Telerik team
answered on 12 Sep 2013, 12:40 PM
Hello Lukasz,

Which version were you previously using? The collection has always consisted of IFilterDescriptor objects which can be either CompositeFilterDescriptor or FilterDescriptor and there is no way to disable this behavior. The CompositeFilterDescriptor is used to specify the logic("or", "and") between the filters.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Lukasz
Top achievements
Rank 1
answered on 13 Sep 2013, 07:42 AM
Hello Daniel, 
I went back to re-check a few previous versions and you're right; there was another error in filters iteration which made it not working as expected unnoticable.

Thanks.
Tags
General Discussions
Asked by
Lukasz
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Lukasz
Top achievements
Rank 1
Share this question
or