I am attempting to create a composite filter in a RadGridView.
I have a column which is a string value (ReasonTrigger) and a column which is a date column (Create Timestamp).
If I specify a single filter (not a composite) and use a Distinct Value for the ReasonTrigger, the dropdown for that column displays all of the possible values for that column for the entire collection associated with the grid. The correct data displays which are only the rows for the alert type. See attached file - WorkingDropdown.png.
I also need to be able to further filter by specifying a Create Timestamp which is within the last 24 hours. If I add a second individual filter (not using composite), the ReasonTrigger dropdown only shows the type that qualifies based on the ReasonTrigger and the date criteria.
If I use a composite combining the ReasonTrigger and the Create Timestamp, the same behavior occurs as the previous example. The drop down only contains the distinct value specified and the correct rows but does not show the other distinct values (which should appear but not be checked). See attached files - NotWorkingDropDown.png and NotWorkingDropDown2.png
Methods below.
Thank you.
Tom
//*************************************************************************************************************
// No composite - single distinct value filter - attached file - WorkingDropDown.png
// this works well for the AlertType (see dropdown image attached - WorkingDropdown.PNG)
private void RefreshGridColumnsByFilterNoComposite()
{
Telerik.Windows.Controls.GridViewColumn countryColumn = this.radGridViewAlerts.Columns.AsQueryable<Telerik.Windows.Controls.GridViewColumn> ().Where(c => c.Name == "ReasonTrigger").FirstOrDefault();
Telerik.Windows.Controls.GridView.IColumnFilterDescriptor countryFilter = countryColumn.ColumnFilterDescriptor;
this.radGridViewAlerts.FilterDescriptors.SuspendNotifications();
countryFilter.DistinctFilter.AddDistinctValue(AlertTypeDescription);
this.radGridViewAlerts.FilterDescriptors.Add(countryFilter);
this.radGridViewAlerts.FilterDescriptors.ResumeNotifications();
}
//*****************************************************************************************
// Composite Filter - Distinct filter and date filter combined into a composite filter - attached files - NotWorkingDropdown.png and NotWorkingDropdown2.png
private void RefreshGridColumnsByFilterComposite()
{
Telerik.Windows.Data.FilterDescriptor createdInLast24Hours;
CompositeFilterDescriptor newForSpecificAlertTypeCompositeFilter;
Telerik.Windows.Controls.GridViewColumn reasonTriggerColumn = this.radGridViewAlerts.Columns.AsQueryable<Telerik.Windows.Controls.GridViewColumn>().Where(c => c.Name == "ReasonTrigger").FirstOrDefault();
Telerik.Windows.Controls.GridView.IColumnFilterDescriptor countryFilter = reasonTriggerColumn.ColumnFilterDescriptor;
newForSpecificAlertTypeCompositeFilter = new CompositeFilterDescriptor();
this.radGridViewAlerts.FilterDescriptors.SuspendNotifications();
// add distinct value filter for
countryFilter.DistinctFilter.AddDistinctValue(AlertTypeDescription);
newForSpecificAlertTypeCompositeFilter.FilterDescriptors.Add(countryFilter);
// add filter for create timestamp
createdInLast24Hours = new Telerik.Windows.Data.FilterDescriptor("CreateTimestamp", Telerik.Windows.Data.FilterOperator.IsGreaterThan, query.GetSQLServerDatetime().AddHours(-24));
newForSpecificAlertTypeCompositeFilter.FilterDescriptors.Add(createdInLast24Hours);
newForSpecificAlertTypeCompositeFilter.LogicalOperator = FilterCompositionLogicalOperator.And;
this.radGridViewAlerts.FilterDescriptors.Add(newForSpecificAlertTypeCompositeFilter);
this.radGridViewAlerts.FilterDescriptors.ResumeNotifications();
}