Filtering opens All the Nodes

4 posts, 0 answers
  1. gans
    gans avatar
    48 posts
    Member since:
    Jan 2012

    Posted 18 Jun 2013 Link to this post

    Sorry - This is supposed to posted  under TreeListView and not TreeView. I will try to repost under TreeListView.

    I have a problem where after applying the Filter, it opens up all the nodes.

    I am using CompositeFilterDescriptor.

    We have a Huge Tree and we don't want the Tree and its children  to open after applying the Filter. Any idea how to stop it from opening after applying the Filter?

    I am not able to attach the project, but will attach the screen shot. 

    Here is code snippet. 

    private void RadContextMenu_ItemClick(object sender, Telerik.Windows.RadRoutedEventArgs e)
            {
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show Spain"))
                {
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "Spain";
                    this.RadTreeListView1.FilterDescriptors.Add(descriptor);
                }
     
                CompositeFilterDescriptor mainFilter = new CompositeFilterDescriptor();
     
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show England"))
                {
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "England";
                    mainFilter.FilterDescriptors.Add(descriptor);
                    this.RadTreeListView1.FilterDescriptors.Add(mainFilter);
                }
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Show England - France"))
                {
                    mainFilter = new CompositeFilterDescriptor();
                    mainFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
                    FilterDescriptor descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "England";
     
                    mainFilter.FilterDescriptors.Add(descriptor);
                    descriptor = new FilterDescriptor();
                    descriptor.Member = "Country";
                    descriptor.Operator = FilterOperator.IsEqualTo;
                    descriptor.Value = "France";
     
                    mainFilter.FilterDescriptors.Add(descriptor);
     
                    this.RadTreeListView1.FilterDescriptors.Add(mainFilter);
                }
     
                if ((e.OriginalSource as RadMenuItem).Header.Equals("Clear Filter"))
                {
                    this.RadTreeListView1.FilterDescriptors.RemoveAt(0);
                }
                 
            }
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 21 Jun 2013 Link to this post

    Hello,

    Expanding the rows when filtering is the behavior by design and currently it cannot be changed. I am afraid that there is not a setting to configure it.
     

    Regards,
    Didie
    Telerik

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Neil
    Neil avatar
    1 posts
    Member since:
    Sep 2014

    Posted 09 Sep 2014 Link to this post

    Has this behavior been changed yet?  It seems helpful to expand the tree to display children nodes that meet the filter criteria sometimes, but I would like to hide an entire row based on a visibility flag in my ViewModel.  While the filter functions correctly, expanding all the other nodes is inconvenient at best; with a large data set, this can be very problematic.

    It would be nice to execute a filter with an optional bool flag to AutoExpandResults after the execution.  I've tried to capture the filter event and collapse manually, but the Filtered event doesn't seem to fire on a filter I create and run in code behind.

    Any help would be appreciated.

  5. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 12 Sep 2014 Link to this post

    Hello,

    I am afraid we have not changed the behavior of RadTreeListView on filtering.

    As to the filtering events, those events are raised only based on user interaction, when the end-user is using the UI to filter. In case you are working with the filters in code, you are the one adding filtering and thus you could take any respective actions you wish. 
    You can also try executing your code in a Dispatcher.

    Regards,
    Dimitrina
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top