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

Filter set programmatically not reflected in UI

3 Answers 50 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Dev
Top achievements
Rank 1
Dev asked on 09 Aug 2012, 07:08 PM
When I set a filter programmatically the built in filtering does not reflect the new filter.
Here is the filter code: 

IColumnFilterDescriptor activeFilter = vehicleListGridView.Columns["Active"].ColumnFilterDescriptor;
activeFilter.SuspendNotifications();
activeFilter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;
activeFilter.FieldFilter.Filter1.Value = "True";
activeFilter.FieldFilter.Filter1.IsCaseSensitive = false;
activeFilter.ResumeNotifications();

The active filter is set. The filter icon in the column header goes orange but when I click on the filter icon True is not selected and when I check true or false it appears to add that filter to the one I set programmatically. 

Is there anyway to set the filter either programmatically or through xaml so that the filter is reflected in the UI and acts exactly as if it was done in the UI?

Thanks,

3 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 10 Aug 2012, 11:04 AM
Hi,

Thank you for the feedback.

We will check what is going on and will contact you as soon as we have more information.

All the best,
Yordanka
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Accepted
Vera
Telerik team
answered on 13 Aug 2012, 08:15 AM
Hi Tom,

Actually, a boolean column cannot be filtered using the Field filters. What you can do is to add a distinct value. See the code bellow.

IColumnFilterDescriptor activeFilter = clubsGrid.Columns["Active"].ColumnFilterDescriptor;
activeFilter.SuspendNotifications();
activeFilter.DistinctFilter.AddDistinctValue(true);
activeFilter.ResumeNotifications();



Regards,
Vera
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Dev
Top achievements
Rank 1
answered on 13 Aug 2012, 03:12 PM
Thank You, This works perfectly. 

Tom
Tags
GridView
Asked by
Dev
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Vera
Telerik team
Dev
Top achievements
Rank 1
Share this question
or