This is a migrated thread and some comments may be shown as answers.

How to get node children count after applying column filter

2 Answers 61 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Vamshi
Top achievements
Rank 1
Vamshi asked on 26 Jun 2013, 04:56 PM
How to get node children count after applying column filter?

I used the following solution for counts, before filtering

http://www.telerik.com/community/forums/wpf/treelist/summing-up-parents-and-children.aspx

Now I am  stuck with counts, after filtering

Can any one help me plz?

2 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 01 Jul 2013, 02:10 PM
Hi,

Unfortunately there is not such a built-in functionality. 
As you calculate the nodes manually, then once the filtering has been applied, you will have to calculate that value. This can be done when the DataLoaded event is raised (after the filtering has been applied).
 

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 >>
0
Dan
Top achievements
Rank 1
answered on 21 Jan 2018, 12:26 AM

I managed to do this by getting the filter expression, and using it to get the filtered items.

private Predicate<T> GetFilterPredicate<T>()
{
  ParameterExpression parm = Expression.Parameter(typeof(T));
  Expression expr = FilterDescriptors.CreateFilterExpression(parm);
  if (expr.NodeType != ExpressionType.Call) return f => true;
  var lambda = Expression.Lambda<Predicate<T>>(expr, parm); return lambda.Compile();
}

This will at lease give you a function for traversing your tree to determine if a node is filtered.

Tags
TreeListView
Asked by
Vamshi
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Dan
Top achievements
Rank 1
Share this question
or