Iterating over DataSourceRequest Filters

3 posts, 1 answers
  1. Lukasz
    Lukasz avatar
    6 posts
    Member since:
    Feb 2013

    Posted 10 Sep 2013 Link to this post

    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. Answer
    Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 12 Sep 2013 Link to this post

    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!
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Lukasz
    Lukasz avatar
    6 posts
    Member since:
    Feb 2013

    Posted 13 Sep 2013 Link to this post

    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.
Back to Top