Filtering like Excel

3 posts, 0 answers
  1. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 04 Oct 2010 Link to this post

    Is there an "out of the box" way to filter columns like Excel does?  In other words, I want the distinct values calculated after each column is filtered and I only want to see the value that still remain in the view.
  2. Rossen Hristov
    Rossen Hristov avatar
    2478 posts

    Posted 05 Oct 2010 Link to this post

    Hi John Thompson,

    This Excel mode IS the out-of-the-box behavior. You can try it. I have attached a sample project. Filter by country. Choose only England. Then go to filter by Player. You will see that only English players are shown. So you do not have to do anything in order to have this -- it is the default mode.

    In case you want to turn this behavior off and show ALL distinct values (i.e. anti-Excel) there is a way to do that as well. Here is how to turn filtering off:

    private void playersGrid_DistinctValuesLoading(object sender, Telerik.Windows.Controls.GridView.GridViewDistinctValuesLoadingEventArgs e)
        var filterDistinctValues = false;
        e.ItemsSource = this.playersGrid.GetDistinctValues(e.Column, filterDistinctValues);

    I have added this to the sample project as well. You can play around with it by uncommenting the code.

    I hope this helps. Let me know if you have any other questions.

    Kind regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. John Thompson
    John Thompson avatar
    44 posts
    Member since:
    Dec 2009

    Posted 05 Oct 2010 Link to this post

    This surely does help... I have implemented the DistinctValuesLoading event handler and I had false as the second parameter to GetDistinctValues.  Changing this to true fixed my handler!  Many thanks!
Back to Top