This is a migrated thread and some comments may be shown as answers.
IColumnFilterDescriptor & DistinctFilter Slowness
2 Answers 10 Views
This is a migrated thread and some comments may be shown as answers.
Richard
Top achievements
Rank 1
Richard asked on 20 Feb 2013, 07:19 PM
Hi,

I have been running into a problem with programmatically filtering a grid. I have been using the IColumnFilterDescriptor  & DistinctFilter, it works but they are very slow when the number of items to filter is high. 

I have a grid of around 20K rows, and I'm adding about 200 items to the Distinct filter. This can take minutes to filter during which the UI is blocked and sometimes crashes completely. 

What's the best way to filter a large grid by a large number of distinct items ?

Also from my code snippet below, you can see what I'm actually trying to do is filter my grid by the currently selected rows, is there a better way of doing this without using the DistinctFilter ?

Thanks,
Richard

IColumnFilterDescriptor columnFilter = matchingColumn.ColumnFilterDescriptor;
columnFilter.SuspendNotifications();
matchingColumn.ClearFilters();
 
List<int> filterItems = (from DeploymentItem row in GridDeploymentList.SelectedItems select row.DeploymentId).ToList();
foreach (int deplymentId in filterItems) columnFilter.DistinctFilter.AddDistinctValue(deplymentId);
 
columnFilter.ResumeNotifications();

2 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 21 Feb 2013, 09:26 AM
Hi,

We use LINQ for filtering. Adding 200 distinct values will produce the following LINQ clause:

var result = sourceCollection.Where(item => item.DeploymentId == 1 || item.DeploymentId == 2 ... item.DeploymentId == 200);

So you can imagine that this LINQ query will not be very fast. Unfortunately, we cannot do anything in order to speed up the Silverlight client. In Silverlight, a Where clause can only be certain length after which the runtime will eventually crash. These are limitations of the runtime which we have no control over.

Building a simpler filter such as DeploymentId > 5 && DeploymentId < 100 will be fatser.

I am afraid that we cannot offer any workaround for the task that you want to achieve.

All the best,
Rossen Hristov
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Richard
Top achievements
Rank 1
answered on 21 Feb 2013, 09:39 AM
Thanks Rossen , that's a shame, I thought it might be something like that but I can't complain the control set set is excellent

Cheers,
Ricard
Asked by
Richard
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Richard
Top achievements
Rank 1
Share this question
or