Tree not expanded in new filter after collapsing it during previous filter

3 posts, 0 answers
  1. Johan
    Johan avatar
    3 posts
    Member since:
    Oct 2010

    Posted 25 Apr Link to this post

    We use the following code to put a filter on tree items which work great intially.

    snip .....

    TreeListView.FilterDescriptors.SuspendNotifications();
    ClearFilters();

    ApplyFilter(Reflector.GetProperty<ProjectReleaseLineViewModel>((line) => line.HasError).Name, true, FilterOperator.IsEqualTo);

    snip ......

     

    private void ClearFilters()
    {
               foreach (var column in TreeListView.Columns.OfType<Telerik.Windows.Controls.GridViewBoundColumnBase>())
               {
                    var filterControl = column.FilteringControl as ColumnFilterControl;
    if (filterControl != null)
    {
    filterControl.Reset(column);
    }
    }
    }

    private void ApplyFilter(string member, object value, FilterOperator @operator = FilterOperator.IsEqualTo)
    {
    var filter = new CompositeFilterDescriptor();
    filter.FilterDescriptors.Add(new FilterDescriptor(member, @operator, value));
    var colum = TreeListView.Columns.OfType<GridViewBoundColumnBase>().Skip(2).First();
    colum.DataControl.FilterDescriptors.Add(filter);
    }

    When performing this action the tree explands showing the lines which have errors.

    The strange behaviour happens after that through the following actions.

    - The use manually collapses the expanded items al the way to level zero

    - Then the filter is cleared through the following code

     

     

  2. Johan
    Johan avatar
    3 posts
    Member since:
    Oct 2010

    Posted 25 Apr in reply to Johan Link to this post

    Sorry the initial item is not complete yet but posted already unintentionally....
  3. Johan
    Johan avatar
    3 posts
    Member since:
    Oct 2010

    Posted 25 Apr Link to this post

    So I will continue my post.

    - The filter is cleared by calling Clearfilters()

    - Then the same filter is applied with exactly the same code.

    - Now the tree is not expanded and the lines wiith errors do not show up.

    - The work around is: manuallly expand the earlier collapsed items again, then clearing the filter. If then a items are collapsed the filter work appropriately again.

    So the questions is why is the treeview behavinf like this and why does it not always expand.

    The Telerik WPF windows library used is: 2012.2.912.35

    Although being in different parts in a post I hope this is clear.

    Thanks,

    Johan

     

     

     

Back to Top