GridView Custom Clear Filter Button

6 posts, 0 answers
  1. Mark Reynolds
    Mark Reynolds avatar
    5 posts
    Member since:
    Aug 2008

    Posted 09 Apr 2012 Link to this post

     have a custon rad button which clear the grid filters. userGrid.FilterDescriptors.Clear();

    But after the clear i still have the filter Control Check boxes checked. What should be done to clear the check boxes. attached is the image of the error
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Apr 2012 Link to this post

    Hello,

     In order to clear the check boxes, you will have to clear the filters for the column. For example:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        this.clubsGrid.Columns["Name"].ClearFilters();
    }

    Calling ClearFilters() will automatically remove filter descriptor from the grid.

    All the best,
    Didie
    the Telerik team

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

  3. DevCraft banner
  4. Mark Reynolds
    Mark Reynolds avatar
    5 posts
    Member since:
    Aug 2008

    Posted 10 Apr 2012 Link to this post

    FilterDescriptors.Clear() method clears the checkboxes with SL4.Is this a new enhancement in with SL5.
    Our Application has about 50-60 gridviews , would there be a fix to clear all checkboxes when the grids FilterDescriptors.Clear() is invoked, instead of coding for each column
  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 10 Apr 2012 Link to this post

    Hi,

    Indeed, we have introduced breaking changes with the Q1 2012 version of the Controls. Please check here for detailed information on all the changes done.

    The changed code, in your case, would look like so:

    this.radGridView.FilterDescriptors.SuspendNotifications();
    foreach (Telerik.Windows.Controls.GridViewColumn column in this.radGridView.Columns)
    {
        column.ClearFilters();
    }
    this.radGridView.FilterDescriptors.ResumeNotifications();

    Simply calling RadGridView.FilterDescriptors.Clear will indeed remove the filtering, but the column filters will preserve their settings (although they will not be part of the FilterDescriptors collection). To completely clear a column filter you have to call column.ClearFilters(); 

    Regards,
    Didie
    the Telerik team

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

  6. saw
    saw avatar
    29 posts
    Member since:
    Jun 2014

    Posted 30 Oct 2014 in reply to Dimitrina Link to this post

    Hi,
    I am using this column.ClearFilters() method in my Reset button (And also clear radGridView.GroupDescriptors.Clear(), radGridView.SortDescriptors.Clear()), .
    But it will not clear the RadGrid.FilterDescriptors.Count . I need FilterDescriptors collection for my RadGrid search.

    How I over come this problem ?
  7. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 31 Oct 2014 Link to this post

    Hi,

    Indeed, the FilterDescriptors will still be available right after you clear the column filters. Still, they will be cleared after all the notifications are restored. I checked the descriptors on a button click after clearing the defined user criteria and their count was 0. Would you please share more details on when do you need to use the FilterDescriptors collection?

    Regards,
    Dimitrina
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top
DevCraft banner