Programmatic clearing of column filters does not update the filter dialog

2 posts, 0 answers
  1. Anne Lyon
    Anne Lyon avatar
    90 posts
    Member since:
    Jan 2010

    Posted 28 Dec 2012 Link to this post

    Hi,

    In my Silverlight 4 application (Telerik v 2012.2.607) I programatically loop through all FilterDescriptors for my grid to find if there is a filter set for a given columnName. If so, I remove the FilterDescriptor for that column from the collection. This works fine, the filter is removed from the grid and all rows are displayed. But if then the user opens the Filter Dialog Box (by clicking the column filter icon), the previous filter selection is still displayed. See attached screen shot. It shows there are no filters set (the column header icon is "off") but still the old value is ticked in the Filter Dialog.
    How do I clear the selections in the Filter Dialog Box for a column when I have removed the FilterDescriptor for that column in code?

    The code to remove the filter descriptor for a given column name is given below:

    gridKolName = selCol.ElementValue.ToString();

     

     

    foreach (IColumnFilterDescriptor desc in MasterGrid.FilterDescriptors)

     

    {

    col = (

     

    GridViewDataColumn)desc.Column;

     

    filterName = col.Header.ToString();

     

     

    if (filterName == gridKolName)

     

    {

    MasterGrid.FilterDescriptors.Remove(desc);

     

     

    break;

     

    }

    }



  2. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2477 posts

    Posted 29 Dec 2012 Link to this post

    Hi,

    Please, take a look at this article for the proper way to clear column filters. You should do something like this:

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

    I hope this helps.

    Regards,
    Rossen Hristov
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top