Welcome to the Xceed Community | Help
Community Search  
More Search Options

Add All DistinctValues To AutoFilterValues

Sort Posts: Previous Next
  •  03-16-2010, 7:08 AM Post no. 26107

    Add All DistinctValues To AutoFilterValues

    Hi,

    I added a button in the AutoFilterControl to enable the user selecting all the distinct values.

    Code sample:

    System.Collections.IList distinctValues = view.DistinctValues[sColumnFieldName];

    foreach (object value in distinctValues)

    {

    view.AutoFilterValues[sColumnFieldName].Add(value);

    }

     

    The problem is that if i have a long list of distinct values that process takes a lot of time ...

    My question : is there a way to add a range of values to the AutoFilterValues collection (i can see that it is xceed custom collection)

  •  03-16-2010, 8:23 AM Post no. 26109 in reply to 26107

    Re: Add All DistinctValues To AutoFilterValues

    what you might want to try is wrapping your loop code in a using (view.DeferRefresh()) {...} statement. That way the grid is only refreshed once at the end of your changes.

  •  03-16-2010, 8:31 AM Post no. 26110 in reply to 26109

    Re: Add All DistinctValues To AutoFilterValues

    Thanks Derek, 

    I already did it and it's still taking a lot of time, i guess that each value i add to the auto filter collection causing inside operations.

    I need a way to add a range or supress the collection events.

  •  03-16-2010, 9:33 AM Post no. 26116 in reply to 26110

    Re: Add All DistinctValues To AutoFilterValues

    There is no AddRange method available to add distinct values; however, I suggest that you use DeferRefresh in order to defer the refresh operations while adding the distinct values.

    using( view.DeferRefresh() )

    {

       ... 


    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  03-16-2010, 9:42 AM Post no. 26117 in reply to 26116

    Re: Add All DistinctValues To AutoFilterValues

    Hi Jenny,

    As i wrote i am using the DeferRefresh ans it's still not helping.

    If i have 1000 distinct values it takes ~20 seconds to perform that action.

    Is there a way that i will create a temp collection and then assign it to the AutoFilter values  collection ?

     

  •  03-16-2010, 9:59 AM Post no. 26119 in reply to 26117

    Re: Add All DistinctValues To AutoFilterValues

    My apologies, I missed the post where you referred to using DeferRefresh. I have talked with one of the developers and he is surprised that it takes as much time as you say it does. Would it be possible for you to provide a repro application so that we may take a look to see what is going on?
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  03-16-2010, 10:55 AM Post no. 26123 in reply to 26119

    Re: Add All DistinctValues To AutoFilterValues

    Hi Jenny,

    How can i send the sample in email ?

  •  03-16-2010, 11:03 AM Post no. 26124 in reply to 26123

    Re: Add All DistinctValues To AutoFilterValues

    You can send it to support@xceed.com. Just make sure you include "case 131595" in the subject line of the email.
    Senior Technical Writer
    - Xceed Software

    In three words I can sum up everything I've learned about life: it goes on.
  •  03-16-2010, 5:41 PM Post no. 26142 in reply to 26124

    Re: Add All DistinctValues To AutoFilterValues

    Hi Yaniv,

    You are probably trying to do an inverse filter, which isn't really supported by the CollectionView.

    The addition of all those distinct values in the source means that for each item in the source, we try to compare the corresponding field to the auto filtering with all the selected auto filter values.

    Because you are adding 1000 auto filter values, for each item in the source, we do 1000 comparisons to see if the item passes or no the filter.

    We can't do anything to optimize that scenario, however perhaps a feature request to do some "inverse filtering", that is have an "exclude auto filter values" which would make it so the item in the source passes the filter if the value of the auto filtered field isn't equal to the auto filter values for that filter.

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
  •  03-17-2010, 1:00 AM Post no. 26151 in reply to 26142

    Re: Add All DistinctValues To AutoFilterValues

    Hi Diane,

    Can you please add a feature request as suggested above ?

    The request is in order to be similar to the Excel filtering feature (When the user open the filtering box all items are selected)

    Thanks,

    Yaniv

  •  03-17-2010, 3:31 AM Post no. 26154 in reply to 26151

    Re: Add All DistinctValues To AutoFilterValues

    Hi Yaniv,

     I have just tried your solution on one of my grids with 1100 distinct values. To perform a "Select All" on a column was taking about 1 second (and similar with a unselect All) - I have a SelectAll and CancelAll button on each of the column filter lists.

    The select all code is as follows:

    DataGridCollectionView view = this.ItemsSource as DataGridCollectionView;

    using (view.DeferRefresh())

    {

      view.AutoFilterValues[sColumnFieldName].Clear();

      System.Collections.IList distinctValues = view.DistinctValues[sColumnFieldName];

      foreach (object value in distinctValues)

      {

        view.AutoFilterValues[sColumnName].Add(value);

      }

    }

     

    My ItemsSource is a DataTable wrapped inside a DataGridCollectionView.

    As Jenny said, if you can send them a testapp they shoudl be able to identify what is causing the delay.

  •  03-17-2010, 4:02 AM Post no. 26155 in reply to 26154

    Re: Add All DistinctValues To AutoFilterValues

    Hi Derek,

     I sent a testapp to the support and you can see the answer from Diane.

    I will appreciate if you could upload your sample and i will check it again.

    Thanks,

    Yaniv

  •  03-22-2010, 3:15 PM Post no. 26234 in reply to 26155

    Re: Add All DistinctValues To AutoFilterValues

    Hi Yaniv,

    A feature request was submitted to the development team. However I do not currently have any time frame available for when this would become available.

     


    ** Quick Tip: Clients with an active support subscription should be sending their questions by email if they wish to benefit from the faster response time. Thanks!


    Diane Lafontaine
    Technical Support
    Xceed Software Inc.
View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.