Hi guys,
As the title states, I'm trying to apply the OR logical operator between multiple column filters instead of the default AND operator that is applied when using the popup UI of the GridView.
I haven't found any simple way of doing this without attaching a DataFilter to the grid, and we do not like the UI of the DataFilter.
What I did come up with is handling the Sorted event and iterating over the columns to get their filters and add them to a compound filter like so:
As the title states, I'm trying to apply the OR logical operator between multiple column filters instead of the default AND operator that is applied when using the popup UI of the GridView.
I haven't found any simple way of doing this without attaching a DataFilter to the grid, and we do not like the UI of the DataFilter.
What I did come up with is handling the Sorted event and iterating over the columns to get their filters and add them to a compound filter like so:
Telerik.Windows.Data.CompositeFilterDescriptor mainFilter =
new
Telerik.Windows.Data.CompositeFilterDescriptor();
mainFilter.LogicalOperator = Telerik.Windows.Data.FilterCompositionLogicalOperator.Or;
this
.dgTaskManager.FilterDescriptors.SuspendNotifications();
foreach
(Telerik.Windows.Controls.GridViewColumn column
in
this
.dgTaskManager.Columns)
{
//Add all active column filters to the main filter
if
(column.ColumnFilterDescriptor.IsActive)
{
mainFilter.FilterDescriptors.Add(column.ColumnFilterDescriptor);
this
.filteredColumnList.Add(column);
}
}
this
.dgTaskManager.FilterDescriptors.Clear();
this
.dgTaskManager.FilterDescriptors.Add(mainFilter);
this
.dgTaskManager.FilterDescriptors.ResumeNotifications();
This works fine in terms of filtering correctly, but the funnel icon of the filtered columns is obviously unaffected since the FilterDescriptors collection of the grid no longer holds the filtered columns directly.
I tried manually setting each filtered column's FilterControl and setting its isActive property to true after ResumeNotifications(), but for some reasons it only highlights the last filtered column's funnel and only after opening and closing the filter control of the other filtered columns does it update their funnel's highlighting correctly. In addition it also doesn't seem to handle removing filters correctly (in terms of UI).
Does anyone have an idea how to achieve this? I can't believe that the need to apply the OR operator between columns hasn't arisen before me, am I missing something obvious?
Thanks
Orr
I tried manually setting each filtered column's FilterControl and setting its isActive property to true after ResumeNotifications(), but for some reasons it only highlights the last filtered column's funnel and only after opening and closing the filter control of the other filtered columns does it update their funnel's highlighting correctly. In addition it also doesn't seem to handle removing filters correctly (in terms of UI).
Does anyone have an idea how to achieve this? I can't believe that the need to apply the OR operator between columns hasn't arisen before me, am I missing something obvious?
Thanks
Orr