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

RadGridView XAML Filter issue

6 Answers 178 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Monte Baker
Top achievements
Rank 2
Monte Baker asked on 03 Jun 2010, 02:03 PM
I am having an issue with the column filter in RadGridView.  When I add a filter to the XAML the filter works on the data load, but the filter is not visible with the alternate values.  What I am trying to do is load by default only non-logical delete values, but to allow the user to edit the filter and return all values if required.  do to the number of controls that I will be placing this logic in it would be preferable to have the filter in XAML rather than C#.  Thank you.
<grid:RadGridView.FilterDescriptors> 
     <telerikData:FilterDescriptor Member="Deleted" 
          Operator="IsEqualTo" 
      Value="False"/>  
</grid:RadGridView.FilterDescriptors>    

6 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 03 Jun 2010, 02:08 PM
Hello Monte Baker,

It seems that you need to pre-filter the grid by using a ColumnFilterDescriptor.

Please, read the documentation topic about ColumnFilterDescriptor and then check out my blog post.

Let me know if there are problems.

Regards,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Monte Baker
Top achievements
Rank 2
answered on 04 Jun 2010, 02:57 PM
Thank you, that worked perfectly
0
Monte Baker
Top achievements
Rank 2
answered on 07 Jun 2010, 08:53 PM
I spoke to soon, I could have sworn that I was getting the correct results, but as I look at it now when I click on the deleted filter the only value that i see is "false".  the code I am using is...

this.VendorGrid.DataContext = VendorBindingCollection;  
ColumnFilterDescriptor deleteColumnFilter = new ColumnFilterDescriptor((IDataFieldDescriptor)this.VendorGrid.Columns[7]);  
deleteColumnFilter.DistinctFilter.DistinctValues.Add(false);  
this.VendorGrid.FilterDescriptors.Add(deleteColumnFilter);  
this.VendorGrid.UpdateLayout();  
this.VendorGrid.IsBusy = false

Is there any guidance that you can provide.
0
Rossen Hristov
Telerik team
answered on 08 Jun 2010, 11:31 AM
Hello Monte Baker,

I have prepared a sample project. Let me know if it does not do what you want or if you expect it should be doing something else.

By doing this: "deleteColumnFilter.DistinctFilter.DistinctValues.Add(false);" you are effectively saying that you want to see only values that are false. This is the meaning of the term distinct value. So that is absolutely correct.

Is it something else that you are after?

Kind regards,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Monte Baker
Top achievements
Rank 2
answered on 09 Jun 2010, 06:16 AM
Sorry about the confusion

What I am trying to do is load all records (Deleted=True and Deleted=False) and then filter the results so that only Deleted=False is initialy visible, but allowing the user to open the filter to look at the logically deleted records.  I have tried the code below, and while this now gives me both options in the filter if you select True it does not show the Deleted=True records

ColumnFilterDescriptor deleteColumnFilter = new ColumnFilterDescriptor((IDataFieldDescriptor)this.InventoryGrid.Columns[10]);  
deleteColumnFilter.FieldFilter.Filter1.Operator = FilterOperator.IsEqualTo;  
deleteColumnFilter.FieldFilter.Filter1.Value = false;  
this.InventoryGrid.FilterDescriptors.Add(deleteColumnFilter);  
this.InventoryGrid.UpdateLayout(); 

Where Columns[10] is my bool Deleted Column.  Any thoughts would be helpful.

Thank you
0
Rossen Hristov
Telerik team
answered on 09 Jun 2010, 07:41 AM
Hi Monte Baker,

This is because the FieldFilter (the two text-boxes on the bottom) and the DistinctValuesFilter (the list of check-boxed on the top) are AND-ed together. What you need to do is add the distinct value "False". This will have the False check-box selected when the user opens the filter. Then when the user clicks on the "True" distinct value check-box he will see both records that are true and false. Alternatively, if he clicks the clear button the result will be the same because seeing both values that are true and false is like having not filter whatsoever.

Anyway, it seems that you desire some very specific to your project logic. In case you want to customize the filtering control and adapt it to your exact needs then you are absolutely free to do that.

Learn how by reading mu blog post. It explains how to develop your very own custom filtering control from scratch. By using this approach you will be in full control over what, when, where and how is going on inside the filtering control. This would be the best solution for your custom requirement.

I hope this helps.

Greetings,
Ross
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
GridView
Asked by
Monte Baker
Top achievements
Rank 2
Answers by
Rossen Hristov
Telerik team
Monte Baker
Top achievements
Rank 2
Share this question
or