Large number of distinct values in DistinctFilter

2 posts, 0 answers
  1. Buzz
    Buzz avatar
    32 posts
    Member since:
    Oct 2010

    Posted 18 Dec 2013 Link to this post

    I am programmatically filtering my gridview.  The gridview has about 2000 rows, with a column called "Tag" of type uint that has a unique value for each row.  In another control, my application user can select or unselect the Tags he wants to see in the gridview.

    I'm using DistinctFilter as shown below.  I'm seeing very poor performance and even a stackoverflow apparently coming from ResumeNotifications (no stack trace is available for that).
    When the user wants to show all 2000 rows, no filtering is needed so that works fine.  But when a single row is to be filtered out, I would AddDistinctValue 1999 times.
    Is there some better way I should be doing this?   

    GridViewColumn tagColumn = this.gridView.Columns["Tag"];
    IColumnFilterDescriptor tagFilter = tagColumn.ColumnFilterDescriptor;
     
    // Suspend the notifications to avoid multiple data engine updates
    tagFilter.SuspendNotifications();
                     
    tagFilter.DistinctFilter.Clear();
     
    foreach (var pair in myDictionary)
    {
        if (pair.Value.IsShown)
        {
            tagFilter.DistinctFilter.AddDistinctValue(pair.Key);
        }
    }
     
    // Resume the notifications to force the data engine to update the filter.
    tagFilter.ResumeNotifications();
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 19 Dec 2013 Link to this post

    Hello,

    Would be please try setting the OptimizeDistinctFilterQuery="True" for the "Tag" column? 

    Regards,
    Didie
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top