I am developing a filter panel usercontrol that will allow my user to create complex filters. My control follows the same structure as the documentation, but it does not work as expected. It appears the last filterdescriptor added to the "main" composite filter is the only filter applied.
http://www.telerik.com/help/winforms/gridview-filtering-setting-filters-programmatically-composite-descriptors.html
So, I took the exact code from the documentation, and it appears it is behaving incorrectly as well. See below. Also, notice my screenshot? I would expect the Expression property to have the combination of the two filterdescriptors similar to the wording in documentation. Thoughts?
http://www.telerik.com/help/winforms/gridview-filtering-setting-filters-programmatically-composite-descriptors.html
So, I took the exact code from the documentation, and it appears it is behaving incorrectly as well. See below. Also, notice my screenshot? I would expect the Expression property to have the combination of the two filterdescriptors similar to the wording in documentation. Thoughts?
Private
Sub
Button2_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
Button2.Click
Dim
oFooData
As
New
BindingList(Of SampleData)
Dim
i
As
Integer
= 1
While
i < 50
oFooData.Add(
New
SampleData(10 * i, 3 * i,
"Game"
))
i += 1
End
While
i = 0
While
i < 50
oFooData.Add(
New
SampleData(5 * i, 0,
"Aatar"
))
i += 1
End
While
RadGridView1.DataSource = oFooData
Dim
compositeFilter1
As
New
CompositeFilterDescriptor()
compositeFilter1.FilterDescriptors.Add(
New
FilterDescriptor(
"UnitsInStock"
, FilterOperator.IsGreaterThan, 100))
compositeFilter1.FilterDescriptors.Add(
New
FilterDescriptor(
"ProductName"
, FilterOperator.StartsWith,
"G"
))
compositeFilter1.LogicalOperator = FilterLogicalOperator.[
Or
]
Dim
filter2
As
New
FilterDescriptor(
"UnitsOnOrder"
, FilterOperator.IsEqualTo, 0)
Dim
filterDescriptor2
As
New
CompositeFilterDescriptor()
filterDescriptor2.FilterDescriptors.Add(compositeFilter1)
filterDescriptor2.FilterDescriptors.Add(filter2)
filterDescriptor2.LogicalOperator = FilterLogicalOperator.[
And
]
Me
.RadGridView1.FilterDescriptors.Add(filterDescriptor2)
End
Sub
Public
Class
SampleData
Property
UnitsInStock
As
Integer
Property
UnitsOnOrder
As
Integer
Property
ProductName
As
String
Public
Sub
New
(
ByVal
UnitsInStock
As
Integer
, UnitsOnOrder
As
Integer
, ProductName
As
String
)
_UnitsInStock = UnitsInStock
_UnitsOnOrder = UnitsOnOrder
_ProductName = ProductName
End
Sub
End
Class