Completed
Last Updated: 19 Jan 2023 14:50 by ADMIN
Martin Ivanov
Created on: 24 Nov 2022 10:15
Category: GridView
Type: Bug Report
0
GridView: Distinct values filtering doesn't work when OptimizeDistinctFilterQuery of the column is set to True and the distinct values are more than 500

Filtering the data by distinct value using the filter query optimization doesn't work properly when adding more than 500 distinct values. To reproduce this, set the OptimizeDistinctFilterQuery property of the corresponding column to True. The distinct values should be filtered using the ColumnFilterDescriptor and the AddDistinctValue method of the DistinctFilter.

In that case, the filter can get reversed and remove the selected distinct values from the data view, instead of adding only them, as would be expected. Or the filter can stop working at all and display all values from the ItemsSource.

To work this around, instead of using the ColumnFilterDescriptor and the AddDistinctValue method, add a composite filter descriptor manually in the FilterDescriptors of RadGridView.

radGridView.FilterDescriptors.SuspendNotifications();
var distinctValuesFilter = new CompositeFilterDescriptor();
distinctValuesFilter.LogicalOperator = FilterCompositionLogicalOperator.Or;
for (int i = 0; i < 5000; i++)
{
	object disctincValue = i;
	var filter = new FilterDescriptor("Id", FilterOperator.IsEqualTo, disctincValue);
	distinctValuesFilter.FilterDescriptors.Add(filter);                
}
radGridView.FilterDescriptors.Add(distinctValuesFilter);
radGridView.FilterDescriptors.ResumeNotifications();

0 comments