Custom filter control and removing filtering on grid

3 posts, 0 answers
  1. Miłosz Cechnicki
    Miłosz Cechnicki avatar
    34 posts
    Member since:
    Sep 2009

    Posted 23 Dec 2011 Link to this post

    Hello,

    I'm using on some column custom filtering controls. Everything works great, until I want to remove all filters on grid using method:
    this.View.grid.FilterDescriptors.Clear();

    In the control I'm creating an ColumnFilterDescriptor object, passing the current column as constructor parameter.

    Then this filter is added as follows:
    this.fieldFilter.FieldFilter.Filter1.Value = this.PhotoStatuses.Where(s => s.IsSelected).Select(s => s.StatusValue).ToList();
     
                    if (!this.column.DataControl.FilterDescriptors.Contains(this.fieldFilter))
                    {
                        this.column.DataControl.FilterDescriptors.Add(this.fieldFilter);
                    }

    When clearing FilterDescriptors collection, filter indicator on all grid columns, that uses default filter controls, shows, that filter is disabled. But on columns, that uses CustomFilterControls, filter indicator is still Active, and after clicking it- filter control is still filled with last selected filter.

    Should I do it in another way?

    Best regards
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Dec 2011 Link to this post

    Hello Miłosz,

     Do you set the filter indicator to be IsActive=True or it becomes active once you add some filter descriptors? Have you followed this blog post to implement your custom filtering?

    All the best,
    Didie
    the Telerik team

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

  3. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 26 Dec 2011 Link to this post

    Hello Miłosz,

     I have an update. When you have applied your own custom filtering, the filtering control does not automatically turn off the filter indicator when the FilterDescriptors are cleared. You will need to do this manually by setting the IsActive property of the FilteringControl to False:

    this.column.FilteringControl.IsActive = false;

    Please check this and let me know how it works.

    Greetings,
    Didie
    the Telerik team

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

Back to Top